Sorted summary for file /box/solution-bin ---------------------------------------------- 32.82 /tmp/cpu-mode-161014-1777968493614990659-37/solution/solution.rs:33 22.52 /tmp/cpu-mode-161014-1777968493614990659-37/solution/solution.rs:34 21.92 /rustc/59807616e1fa2540724bfbac14d7976d7e4a3860/library/core/src/ptr/const_ptr.rs:863 11.73 /rustc/59807616e1fa2540724bfbac14d7976d7e4a3860/library/core/src/num/uint_macros.rs:2494 5.07 /tmp/cpu-mode-161014-1777968493614990659-37/solution/solution.rs:31 4.20 /tmp/cpu-mode-161014-1777968493614990659-37/solution/solution.rs:30 1.51 /tmp/cpu-mode-161014-1777968493614990659-37/solution/solution.rs:36 Samples | Source code & Disassembly of /box/solution-bin for cpu_core/cycles/P (8289 samples, percent: local period) -------------------------------------------------------------------------------------------------------------------------- : : : : 3 Disassembly of section .text: : : 5 0000000000014bd0 : : 6 } : : 8 sum + cur : 9 } : : 11 fn main() { 0 : 14bd0: push rbp 0 : 14bd1: mov rbp,rsp 0 : 14bd4: push rbx 0 : 14bd5: sub rsp,0x38 : 16 let stdin = std::io::stdin(); 0 : 14bd9: call QWORD PTR [rip+0x414c1] # 560a0 <_DYNAMIC+0x250> 0 : 14bdf: mov QWORD PTR [rbp-0x40],rax : 19 let fd = stdin.as_raw_fd(); : : 21 let size = unsafe { lseek(fd, 0, SEEK_END) }; 0 : 14be3: xor edi,edi 0 : 14be5: xor esi,esi 0 : 14be7: mov edx,0x2 0 : 14bec: call QWORD PTR [rip+0x414b6] # 560a8 : 26 if size > 0 { 0 : 14bf2: test rax,rax 0 : 14bf5: jle 14cad 0 : 14bfb: mov rbx,rax : 30 let _ = unsafe { lseek(fd, 0, SEEK_SET) }; 0 : 14bfe: xor edi,edi 0 : 14c00: xor esi,esi 0 : 14c02: xor edx,edx 0 : 14c04: call QWORD PTR [rip+0x4149e] # 560a8 : 35 let len = size as usize; : 36 let ptr = unsafe { mmap(std::ptr::null_mut(), len, PROT_READ, MAP_PRIVATE, fd, 0) }; 0 : 14c0a: xor edi,edi 0 : 14c0c: mov rsi,rbx 0 : 14c0f: mov edx,0x1 0 : 14c14: mov ecx,0x2 0 : 14c19: xor r8d,r8d 0 : 14c1c: xor r9d,r9d 0 : 14c1f: call QWORD PTR [rip+0x4148b] # 560b0 : : 45 if (ptr as isize) != -1 { 0 : 14c25: cmp rax,0xffffffffffffffff 0 : 14c29: je 14cad 0 : 14c2f: mov rdx,rbx 0 : 14c32: add rdx,rax 0 : 14c35: xor ecx,ecx 0 : 14c37: xor edi,edi 0 : 14c39: mov rsi,rax 0 : 14c3c: jmp 14c54 0 : 14c3e: xchg ax,ax : 55 cur = cur * 10 + d as u64; 98 : 14c40: lea rdi,[rdi+rdi*4] // /tmp/cpu-mode-161014-1777968493614990659-37/solution/solution.rs:34 19 : 14c44: movzx r8d,r8b 1769 : 14c48: lea rdi,[r8+rdi*2] 1762 : 14c4c: inc rsi // /rustc/59807616e1fa2540724bfbac14d7976d7e4a3860/library/core/src/ptr/const_ptr.rs:863 : 60 while p < end { 59 : 14c4f: cmp rsi,rdx // /tmp/cpu-mode-161014-1777968493614990659-37/solution/solution.rs:30 0 : 14c52: jae 14c6f : 63 let c = unsafe { *p }; 421 : 14c54: movzx r8d,BYTE PTR [rsi] // /tmp/cpu-mode-161014-1777968493614990659-37/solution/solution.rs:31 971 : 14c58: add r8b,0xd0 // /rustc/59807616e1fa2540724bfbac14d7976d7e4a3860/library/core/src/num/uint_macros.rs:2494 : 66 if d <= 9 { 127 : 14c5c: cmp r8b,0xa // /tmp/cpu-mode-161014-1777968493614990659-37/solution/solution.rs:33 2593 : 14c60: jb 14c40 : 69 sum += cur; 125 : 14c62: add rcx,rdi // /tmp/cpu-mode-161014-1777968493614990659-37/solution/solution.rs:36 0 : 14c65: xor edi,edi 55 : 14c67: inc rsi // /rustc/59807616e1fa2540724bfbac14d7976d7e4a3860/library/core/src/ptr/const_ptr.rs:863 : 73 while p < end { 0 : 14c6a: cmp rsi,rdx 290 : 14c6d: jb 14c54 // /tmp/cpu-mode-161014-1777968493614990659-37/solution/solution.rs:30 : 76 sum + cur 0 : 14c6f: add rcx,rdi : 78 let buf = unsafe { std::slice::from_raw_parts(ptr as *const u8, len) }; : 79 let sum = sum_bytes(buf); 0 : 14c72: mov QWORD PTR [rbp-0x18],rcx : 81 let _ = unsafe { munmap(ptr, len) }; 0 : 14c76: mov rdi,rax 0 : 14c79: mov rsi,rbx 0 : 14c7c: call QWORD PTR [rip+0x41436] # 560b8 0 : 14c82: lea rax,[rbp-0x18] : 86 print!("{sum}"); 0 : 14c86: mov QWORD PTR [rbp-0x38],rax 0 : 14c8a: mov rax,QWORD PTR [rip+0x4142f] # 560c0 <_DYNAMIC+0x270> 0 : 14c91: mov QWORD PTR [rbp-0x30],rax 0 : 14c95: lea rdi,[rip+0xffffffffffff3595] # 8231 0 : 14c9c: lea rsi,[rbp-0x38] 0 : 14ca0: call QWORD PTR [rip+0x41422] # 560c8 <_DYNAMIC+0x278> : : 94 let mut buf = Vec::new(); : 95 stdin.lock().read_to_end(&mut buf).unwrap(); : 96 let sum = sum_bytes(&buf); : 97 print!("{sum}"); : 98 } 0 : 14ca6: add rsp,0x38 0 : 14caa: pop rbx 0 : 14cab: pop rbp 0 : 14cac: ret 0 : 14cad: mov QWORD PTR [rbp-0x38],0x0 0 : 14cb5: mov QWORD PTR [rbp-0x30],0x1 0 : 14cbd: mov QWORD PTR [rbp-0x28],0x0 0 : 14cc5: lea rdi,[rbp-0x40] : 107 stdin.lock().read_to_end(&mut buf).unwrap(); 0 : 14cc9: call QWORD PTR [rip+0x41401] # 560d0 <_DYNAMIC+0x280> 0 : 14ccf: mov QWORD PTR [rbp-0x18],rax 0 : 14cd3: and dl,0x1 0 : 14cd6: mov BYTE PTR [rbp-0x10],dl 0 : 14cd9: lea rdi,[rbp-0x18] 0 : 14cdd: lea rsi,[rbp-0x38] 0 : 14ce1: call QWORD PTR [rip+0x413f1] # 560d8 <_DYNAMIC+0x288> 0 : 14ce7: cmp rax,0x1 0 : 14ceb: je 14dc0 0 : 14cf1: mov rbx,QWORD PTR [rbp-0x18] 0 : 14cf5: cmp BYTE PTR [rbp-0x10],0x0 0 : 14cf9: jne 14d11 0 : 14cfb: mov rax,QWORD PTR [rip+0x41386] # 56088 <_DYNAMIC+0x238> 0 : 14d02: mov rax,QWORD PTR [rax] 0 : 14d05: shl rax,1 0 : 14d08: test rax,rax 0 : 14d0b: jne 14df8 0 : 14d11: xor eax,eax 0 : 14d13: xchg DWORD PTR [rbx],eax 0 : 14d15: cmp eax,0x2 0 : 14d18: je 14dea 0 : 14d1e: mov rcx,QWORD PTR [rbp-0x28] : 130 while p < end { 0 : 14d22: test rcx,rcx 0 : 14d25: je 14d73 0 : 14d27: mov rdx,QWORD PTR [rbp-0x30] 0 : 14d2b: add rcx,rdx 0 : 14d2e: xor eax,eax 0 : 14d30: xor esi,esi 0 : 14d32: jmp 14d54 0 : 14d34: data16 data16 cs nop WORD PTR [rax+rax*1+0x0] : 139 cur = cur * 10 + d as u64; 0 : 14d40: lea rsi,[rsi+rsi*4] 0 : 14d44: movzx edi,dil 0 : 14d48: lea rsi,[rdi+rsi*2] 0 : 14d4c: inc rdx : 144 while p < end { 0 : 14d4f: cmp rdx,rcx 0 : 14d52: jae 14d6e : 147 let c = unsafe { *p }; 0 : 14d54: movzx edi,BYTE PTR [rdx] 0 : 14d57: add dil,0xd0 : 150 if d <= 9 { 0 : 14d5b: cmp dil,0xa 0 : 14d5f: jb 14d40 : 153 sum += cur; 0 : 14d61: add rax,rsi 0 : 14d64: xor esi,esi 0 : 14d66: inc rdx : 157 while p < end { 0 : 14d69: cmp rdx,rcx 0 : 14d6c: jb 14d54 : 160 sum + cur 0 : 14d6e: add rax,rsi 0 : 14d71: jmp 14d75 0 : 14d73: xor eax,eax : 164 let sum = sum_bytes(&buf); 0 : 14d75: mov QWORD PTR [rbp-0x20],rax 0 : 14d79: lea rax,[rbp-0x20] : 167 print!("{sum}"); 0 : 14d7d: mov QWORD PTR [rbp-0x18],rax 0 : 14d81: mov rax,QWORD PTR [rip+0x41338] # 560c0 <_DYNAMIC+0x270> 0 : 14d88: mov QWORD PTR [rbp-0x10],rax 0 : 14d8c: lea rdi,[rip+0xffffffffffff349e] # 8231 0 : 14d93: lea rsi,[rbp-0x18] 0 : 14d97: call QWORD PTR [rip+0x4132b] # 560c8 <_DYNAMIC+0x278> : 174 } 0 : 14d9d: mov rsi,QWORD PTR [rbp-0x38] 0 : 14da1: test rsi,rsi 0 : 14da4: je 14ca6 0 : 14daa: mov rdi,QWORD PTR [rbp-0x30] 0 : 14dae: mov edx,0x1 0 : 14db3: call QWORD PTR [rip+0x412c7] # 56080 <_DYNAMIC+0x230> 0 : 14db9: add rsp,0x38 0 : 14dbd: pop rbx 0 : 14dbe: pop rbp 0 : 14dbf: ret 0 : 14dc0: mov QWORD PTR [rbp-0x20],rdx 0 : 14dc4: lea rdi,[rip+0xffffffffffff2d75] # 7b40 0 : 14dcb: lea rcx,[rip+0x3f316] # 540e8 <__frame_dummy_init_array_entry+0x38> 0 : 14dd2: lea r8,[rip+0x3f32f] # 54108 <__frame_dummy_init_array_entry+0x58> 0 : 14dd9: lea rdx,[rbp-0x20] 0 : 14ddd: mov esi,0x2b 0 : 14de2: call QWORD PTR [rip+0x412f8] # 560e0 <_DYNAMIC+0x290> 0 : 14de8: ud2 0 : 14dea: mov rdi,rbx 0 : 14ded: call QWORD PTR [rip+0x4129d] # 56090 <_DYNAMIC+0x240> 0 : 14df3: jmp 14d1e 0 : 14df8: call QWORD PTR [rip+0x4129a] # 56098 <_DYNAMIC+0x248> 0 : 14dfe: test al,al 0 : 14e00: jne 14d11 0 : 14e06: mov BYTE PTR [rbx+0x4],0x1 0 : 14e0a: jmp 14d11 0 : 14e0f: mov rbx,rax 0 : 14e12: jmp 14e25 0 : 14e14: mov rbx,rax 0 : 14e17: jmp 14e31 0 : 14e19: mov rbx,rax 0 : 14e1c: lea rdi,[rbp-0x20] 0 : 14e20: call 14ad0 > : 208 stdin.lock().read_to_end(&mut buf).unwrap(); 0 : 14e25: mov rdi,QWORD PTR [rbp-0x18] 0 : 14e29: mov esi,DWORD PTR [rbp-0x10] 0 : 14e2c: call 14b80 > : 212 } 0 : 14e31: mov rsi,QWORD PTR [rbp-0x38] 0 : 14e35: test rsi,rsi 0 : 14e38: je 14e49 0 : 14e3a: mov rdi,QWORD PTR [rbp-0x30] 0 : 14e3e: mov edx,0x1 0 : 14e43: call QWORD PTR [rip+0x41237] # 56080 <_DYNAMIC+0x230> 0 : 14e49: mov rdi,rbx 0 : 14e4c: call 53070 <_Unwind_Resume@plt> : 221 fn main() { 0 : 14e51: call QWORD PTR [rip+0x41291] # 560e8 <_DYNAMIC+0x298> 0 : 14e57: call QWORD PTR [rip+0x4128b] # 560e8 <_DYNAMIC+0x298> Sorted summary for file /box/solution-bin ---------------------------------------------- 100.00 /rustc/59807616e1fa2540724bfbac14d7976d7e4a3860/library/std/src/sys/backtrace.rs:162 Samples | Source code & Disassembly of /box/solution-bin for cpu_core/cycles/P (1 samples, percent: local period) ----------------------------------------------------------------------------------------------------------------------- : : : : 3 Disassembly of section .text: : : 5 0000000000014ab0 : 1 : 14ab0: push rbp // /rustc/59807616e1fa2540724bfbac14d7976d7e4a3860/library/std/src/sys/backtrace.rs:162 0 : 14ab1: mov rbp,rsp 0 : 14ab4: call rdi 0 : 14ab6: pop rbp 0 : 14ab7: ret