LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/utkukaratas[P]xkeylayers/xkeylayers.cpp
// Function: handle_modifier(TModifierKey*, bool, int)
void handle_modifier(TModifierKey* mod, bool mouse_pressed, int key_event)
{
    if (key_event == KeyPress)
    {
        debug("Key pressed!\n");
        mod->is_down = True;

        if (app.timeout_valid)
            gettimeofday(&mod->down_at, NULL);

        if (mouse_pressed)
        {
            mod->used = True;
        }

        // testing heuristic 1
        if (heuristic_test1(mod)) {
            // if heuristic func returns true this means user probably wants
            // the key itself (space) not the modifier.
            app.trigger_key(mod);
            mod->used = true;
        }
    }
    else
    {
        debug("Key released!\n");
        if (!mod->used)
        {
            timeval down_time = app.timeout;
            if (app.timeout_valid)
            {
                gettimeofday(&down_time, NULL);
                timersub(&down_time, &mod->down_at, &down_time);
            }

            if (!app.timeout_valid ||
                timercmp(&down_time, &app.timeout, <))
            {
                // so a modifier key was pressed shortly.
                // generate fake keys (actually... press and release events).
                app.trigger_key(mod);
            }
        }
        mod->used = False;
        mod->is_down = False;
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
cmpl $0x2, %edx
jne 0x2a3d
movl %esi, %ebp
leaq 0x1788(%rip), %rdi      # 0x4178
xorl %eax, %eax
callq 0x2577
movb $0x1, 0x29(%rbx)
cmpb $0x1, 0x389e(%rip)      # 0x62a0
jne 0x2a0f
leaq 0x30(%rbx), %rdi
xorl %esi, %esi
callq 0x2240
testb %bpl, %bpl
je 0x2a18
movb $0x1, 0x28(%rbx)
callq 0x2b96
testb %al, %al
je 0x2adf
leaq 0x3784(%rip), %rdi      # 0x61b0
movq %rbx, %rsi
callq 0x261e
movb $0x1, 0x28(%rbx)
jmp 0x2adf
leaq 0x1742(%rip), %rdi      # 0x4186
xorl %eax, %eax
callq 0x2577
cmpb $0x0, 0x28(%rbx)
jne 0x2ada
movdqu 0x3833(%rip), %xmm0     # 0x6290
movdqa %xmm0, (%rsp)
cmpb $0x1, 0x3837(%rip)      # 0x62a0
jne 0x2aa7
movq %rsp, %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x2240
movdqa (%r14), %xmm0
movdqu 0x30(%rbx), %xmm1
psubq %xmm1, %xmm0
movdqa %xmm0, (%r14)
pshufd $0xee, %xmm0, %xmm1     # xmm1 = xmm0[2,3,2,3]
movq %xmm1, %rax
testq %rax, %rax
jns 0x2aa7
paddq 0x157e(%rip), %xmm0     # 0x4020
movdqa %xmm0, (%rsp)
cmpb $0x1, 0x37f2(%rip)      # 0x62a0
jne 0x2acb
movq 0x37d9(%rip), %rax      # 0x6290
cmpq %rax, (%rsp)
jne 0x2ac9
movq 0x8(%rsp), %rax
cmpq 0x37cf(%rip), %rax      # 0x6298
jge 0x2ada
leaq 0x36de(%rip), %rdi      # 0x61b0
movq %rbx, %rsi
callq 0x261e
andw $0x0, 0x28(%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/utkukaratas[P]xkeylayers/xkeylayers.cpp
// Function: sig_handler(void*)
void* sig_handler(void *user_data)
{
    TApplication *self = (TApplication*)user_data;
    int sig;

    debug("sig_handler running...\n");

    sigwait(&self->_sigset, &sig);

    debug("Caught signal %d!\n", sig);

    if (!XRecordDisableContext(self->_ctrl_conn, self->_record_ctx))
    {
        fprintf(stderr, "Failed to disable xrecord context\n");
        exit(EXIT_FAILURE);
    }

    XSync(self->_ctrl_conn, False);

    debug("sig_handler exiting...\n");

    return NULL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x153e(%rip), %rdi      # 0x4195
xorl %eax, %eax
callq 0x2577
leaq 0x20(%rbx), %rdi
leaq 0x4(%rsp), %r14
movq %r14, %rsi
callq 0x2080
movl (%r14), %esi
leaq 0x1534(%rip), %rdi      # 0x41ad
xorl %eax, %eax
callq 0x2577
movq 0x8(%rbx), %rdi
movq 0x10(%rbx), %rsi
callq 0x2270
testl %eax, %eax
je 0x2cb4
movq 0x8(%rbx), %rdi
xorl %esi, %esi
callq 0x22e0
leaq 0x1540(%rip), %rdi      # 0x41e3
xorl %eax, %eax
callq 0x2577
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x3315(%rip), %rax      # 0x5fd0
movq (%rax), %rcx
leaq 0x14fb(%rip), %rdi      # 0x41c0
pushq $0x22
popq %rsi
pushq $0x1
popq %rdx
callq 0x22f0
pushq $0x1
popq %rdi
callq 0x21a0
// File: /workspace/github_cpp_makefile_star2_O2/DavieV[P]virtual-usb-printer/usbip.cc
// Function: set_op_rep_device(_USB_DEVICE_DESCRIPTOR const&, _USB_CONFIGURATION_DESCRIPTOR const&, _OP_REP_DEVICE*)
void set_op_rep_device(const USB_DEVICE_DESCRIPTOR& dev_dsc,
                       const USB_CONFIGURATION_DESCRIPTOR& config,
                       OP_REP_DEVICE* device) {
  // Set constants.
  memset(device->usbPath, 0, 256);
  strcpy(device->usbPath, kUsbPath);
  memset(device->busID, 0, 32);
  strcpy(device->busID, kBusId);

  device->busnum=htonl(1);
  device->devnum=htonl(2);
  device->speed=htonl(2);

  // Set values using |device|.
  device->idVendor = htons(dev_dsc.idVendor);
  device->idProduct = htons(dev_dsc.idProduct);
  device->bcdDevice = htons(dev_dsc.bcdDevice);
  device->bDeviceClass = dev_dsc.bDeviceClass;
  device->bDeviceSubClass = dev_dsc.bDeviceSubClass;
  device->bDeviceProtocol = dev_dsc.bDeviceProtocol;
  device->bNumConfigurations = dev_dsc.bNumConfigurations;

  // Set values using |config|.
  device->bConfigurationValue = config.bConfigurationValue;
  device->bNumInterfaces = config.bNumInterfaces;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x2e(%rdx), %rdi
movl $0xd2, %edx
xorl %esi, %esi
callq 0x1110
movaps 0x1c92(%rip), %xmm0     # 0x3010
movups %xmm0, (%rbx)
movaps 0x1c98(%rip), %xmm0     # 0x3020
movups %xmm0, 0x10(%rbx)
movups 0x1c9b(%rip), %xmm0     # 0x302e
movups %xmm0, 0x1e(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x104(%rbx)
movups %xmm0, 0x110(%rbx)
movl $0x312d31, 0x100(%rbx)  # imm = 0x312D31
movabsq $0x200000001000000, %rax # imm = 0x200000001000000
movq %rax, 0x120(%rbx)
movl $0x2000000, 0x128(%rbx) # imm = 0x2000000
movzwl 0x8(%r15), %eax
rolw $0x8, %ax
movw %ax, 0x12c(%rbx)
movzwl 0xa(%r15), %eax
rolw $0x8, %ax
movw %ax, 0x12e(%rbx)
movzwl 0xc(%r15), %eax
rolw $0x8, %ax
movw %ax, 0x130(%rbx)
movb 0x4(%r15), %al
movb %al, 0x132(%rbx)
movb 0x5(%r15), %al
movb %al, 0x133(%rbx)
movb 0x6(%r15), %al
movb %al, 0x134(%rbx)
movb 0x11(%r15), %al
movb %al, 0x136(%rbx)
movb 0x5(%r14), %al
movb %al, 0x135(%rbx)
movb 0x4(%r14), %al
movb %al, 0x137(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/DavieV[P]virtual-usb-printer/usbip.cc
// Function: set_op_rep_devlist_interfaces(std::vector<_USB_INTERFACE_DESCRIPTOR, std::allocator<_USB_INTERFACE_DESCRIPTOR>> const&, _OP_REP_DEVLIST_INTERFACE**)
void set_op_rep_devlist_interfaces(
    const std::vector<USB_INTERFACE_DESCRIPTOR>& interfaces,
    OP_REP_DEVLIST_INTERFACE **rep_interfaces) {
  // TODO(daviev): Change this to use a smart pointer at some point.
  *rep_interfaces = (OP_REP_DEVLIST_INTERFACE *)malloc(
      interfaces.size() * sizeof(OP_REP_DEVLIST_INTERFACE));
  for (size_t i = 0; i < interfaces.size(); ++i) {
    const auto& interface = interfaces[i];
    (*rep_interfaces)[i].bInterfaceClass = interface.bInterfaceClass;
    (*rep_interfaces)[i].bInterfaceSubClass = interface.bInterfaceSubClass;
    (*rep_interfaces)[i].bInterfaceProtocol = interface.bInterfaceProtocol;
    (*rep_interfaces)[i].padding = 0;
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq 0x8(%rdi), %rax
subq (%rdi), %rax
pushq $0x9
popq %r15
cqto
idivq %r15
leaq (,%rax,4), %rdi
callq 0x11b0
movq %rax, %rcx
movq %rax, (%rbx)
movq (%r14), %rsi
movq 0x8(%r14), %rax
subq %rsi, %rax
cqto
idivq %r15
addq $0x7, %rsi
xorl %edx, %edx
cmpq %rax, %rdx
jae 0x14ae
movb -0x2(%rsi), %dil
movb %dil, (%rcx,%rdx,4)
movb -0x1(%rsi), %dil
movb %dil, 0x1(%rcx,%rdx,4)
movb (%rsi), %dil
movb %dil, 0x2(%rcx,%rdx,4)
movb $0x0, 0x3(%rcx,%rdx,4)
incq %rdx
addq $0x9, %rsi
jmp 0x1482
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/DavieV[P]virtual-usb-printer/usbip.cc
// Function: handle_device_list(UsbPrinter const&, int)
void handle_device_list(const UsbPrinter& printer, int sockfd) {
  OP_REP_DEVLIST list;
  printf("list devices\n");

  create_op_rep_devlist(printer.device_descriptor(),
                        printer.configuration_descriptor(),
                        printer.interfaces(), &list);

  ssize_t sent = send(sockfd, &list.header, sizeof(list.header), 0);
  if (sent != sizeof(OP_REP_DEVLIST_HEADER)) {
    printf("send error : %s \n", strerror(errno));
    goto cleanup;
  }

  sent = send(sockfd, &list.device, sizeof(list.device), 0);
  if (sent != sizeof(list.device)) {
    printf("send error : %s \n", strerror(errno));
    goto cleanup;
  }

  sent = send(sockfd, list.interfaces,
              sizeof(*list.interfaces) * list.device.bNumInterfaces, 0);
  if (sent != sizeof(*list.interfaces) * list.device.bNumInterfaces) {
    printf("send error : %s \n", strerror(errno));
    goto cleanup;
  }

cleanup:
  free(list.interfaces);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x190, %rsp            # imm = 0x190
movl %esi, %ebx
movq %rdi, %r14
leaq 0x1c71(%rip), %rdi      # 0x3181
callq 0x11e0
movzwl 0x10(%r14), %eax
leaq 0x10(%rsp), %r15
movw %ax, 0x10(%r15)
movups (%r14), %xmm0
movaps %xmm0, (%r15)
movq 0x12(%r14), %rax
movb 0x1a(%r14), %cl
movq %rsp, %r12
movq %rax, (%r12)
movb %cl, 0x8(%r12)
addq $0x50, %r14
leaq 0x28(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x19d0
leaq 0x44(%rsp), %r14
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %r14, %rcx
callq 0x14b4
movq %r13, %rdi
callq 0x1a24
pushq $0xc
popq %rdx
movl %ebx, %edi
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x10f0
cmpq $0xc, %rax
jne 0x15ce
leaq 0x50(%rsp), %rsi
movl $0x138, %edx            # imm = 0x138
movl %ebx, %edi
xorl %ecx, %ecx
callq 0x10f0
cmpq $0x138, %rax            # imm = 0x138
jne 0x15ce
movq 0x188(%rsp), %rsi
movzbl 0x187(%rsp), %edx
shll $0x2, %edx
movl %ebx, %edi
xorl %ecx, %ecx
callq 0x10f0
movzbl 0x187(%rsp), %ecx
shll $0x2, %ecx
cmpq %rcx, %rax
je 0x15eb
callq 0x1040
movl (%rax), %edi
callq 0x10b0
leaq 0x1a5d(%rip), %rdi      # 0x303e
movq %rax, %rsi
xorl %eax, %eax
callq 0x1050
movq 0x188(%rsp), %rdi
callq 0x1180
addq $0x190, %rsp            # imm = 0x190
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/DavieV[P]virtual-usb-printer/usbip.cc
// Function: handle_attach(UsbPrinter const&, int)
int handle_attach(const UsbPrinter& printer, int sockfd) {
  char busid[32];
  OP_REP_IMPORT rep;
  printf("attach device\n");
  ssize_t received = recv(sockfd, busid, 32, 0);
  if (received != 32) {
    printf("receive error : %s \n", strerror(errno));
    return 1;
  }
  create_op_rep_import(printer.device_descriptor(),
                       printer.configuration_descriptor(), &rep);
  ssize_t sent = send(sockfd, &rep, sizeof(rep), 0);
  if (sent != sizeof(rep)) {
    printf("send error : %s \n", strerror(errno));
    return 1;
  }
  return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x190, %rsp            # imm = 0x190
movl %esi, %ebp
movq %rdi, %r14
leaq 0x1b5e(%rip), %rdi      # 0x318e
callq 0x11e0
leaq 0x30(%rsp), %rsi
pushq $0x20
popq %rdx
xorl %ebx, %ebx
movl %ebp, %edi
xorl %ecx, %ecx
callq 0x10a0
cmpq $0x20, %rax
jne 0x16a3
movzwl 0x10(%r14), %eax
leaq 0x10(%rsp), %rdi
movw %ax, 0x10(%rdi)
movups (%r14), %xmm0
movaps %xmm0, (%rdi)
movq 0x12(%r14), %rax
movb 0x1a(%r14), %cl
movq %rsp, %rsi
movq %rax, (%rsi)
movb %cl, 0x8(%rsi)
leaq 0x50(%rsp), %r14
movq %r14, %rdx
callq 0x1609
movl $0x140, %edx            # imm = 0x140
movl %ebp, %edi
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x10f0
cmpq $0x140, %rax            # imm = 0x140
je 0x16c6
leaq 0x199d(%rip), %rbx      # 0x303e
jmp 0x16aa
leaq 0x19a6(%rip), %rbx      # 0x3050
callq 0x1040
movl (%rax), %edi
callq 0x10b0
movq %rbx, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x1050
pushq $0x1
popq %rbx
movl %ebx, %eax
addq $0x190, %rsp            # imm = 0x190
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/DavieV[P]virtual-usb-printer/usbip.cc
// Function: pack_usbip(int*, unsigned long)
void pack_usbip(int *data, size_t msg_size) {
  int size = msg_size / 4;
  for (int i = 0; i < size; i++) {
    data[i] = htonl(data[i]);
  }
  // Put |setup| into network byte order. Since |setup| is a 64-bit integer we
  // have to swap the final 2 int entries since they are both a part of |setup|.
  swap(&data[size - 1], &data[size - 2]);
}

// Assembly:
shrq $0x2, %rsi
xorl %eax, %eax
testl %esi, %esi
movl $0x0, %ecx
cmovgl %esi, %ecx
cmpq %rax, %rcx
je 0x16ff
movl (%rdi,%rax,4), %edx
bswapl %edx
movl %edx, (%rdi,%rax,4)
incq %rax
jmp 0x16ed
shlq $0x20, %rsi
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
addq %rsi, %rax
sarq $0x1e, %rax
movabsq $-0x200000000, %rcx     # imm = 0xFFFFFFFE00000000
addq %rsi, %rcx
sarq $0x1e, %rcx
movl (%rdi,%rax), %edx
movl (%rdi,%rcx), %esi
movl %esi, (%rdi,%rax)
movl %edx, (%rdi,%rcx)
retq
// File: /workspace/github_cpp_makefile_star2_O2/DavieV[P]virtual-usb-printer/usbip.cc
// Function: unpack_usbip(int*, unsigned long)
void unpack_usbip(int *data, size_t msg_size) {
  int size = msg_size / 4;
  for (int i = 0; i < size; i++) {
    data[i] = ntohl(data[i]);
  }
  // Put |setup| into host byte order. Since |setup| is a 64-bit integer we
  // have to swap the final 2 int entries since they are both a part of |setup|.
  swap(&data[size - 1], &data[size - 2]);
}

// Assembly:
shrq $0x2, %rsi
xorl %eax, %eax
testl %esi, %esi
movl $0x0, %ecx
cmovgl %esi, %ecx
cmpq %rax, %rcx
je 0x1754
movl (%rdi,%rax,4), %edx
bswapl %edx
movl %edx, (%rdi,%rax,4)
incq %rax
jmp 0x1742
shlq $0x20, %rsi
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
addq %rsi, %rax
sarq $0x1e, %rax
movabsq $-0x200000000, %rcx     # imm = 0xFFFFFFFE00000000
addq %rsi, %rcx
sarq $0x1e, %rcx
movl (%rdi,%rax), %edx
movl (%rdi,%rcx), %esi
movl %esi, (%rdi,%rax)
movl %edx, (%rdi,%rcx)
retq
// File: /workspace/github_cpp_makefile_star2_O2/DavieV[P]virtual-usb-printer/usbip.cc
// Function: print_usbip_cmd_submit(_USBIP_CMD_SUBMIT const&)
void print_usbip_cmd_submit(const USBIP_CMD_SUBMIT& command) {
  printf("usbip cmd %u\n", command.command);
  printf("usbip seqnum %u\n", command.seqnum);
  printf("usbip devid %u\n", command.devid);
  printf("usbip direction %u\n", command.direction);
  printf("usbip ep %u\n", command.ep);
  printf("usbip flags %u\n", command.transfer_flags);
  printf("usbip number of packets %u\n", command.number_of_packets);
  printf("usbip interval %u\n", command.interval);
  printf("usbip setup %llu\n", command.setup);
  printf("usbip buffer length  %u\n", command.transfer_buffer_length);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl (%rdi), %esi
leaq 0x18d1(%rip), %rdi      # 0x3065
xorl %eax, %eax
callq 0x1050
movl 0x4(%rbx), %esi
leaq 0x18ce(%rip), %rdi      # 0x3073
xorl %eax, %eax
callq 0x1050
movl 0x8(%rbx), %esi
leaq 0x18ce(%rip), %rdi      # 0x3084
xorl %eax, %eax
callq 0x1050
movl 0xc(%rbx), %esi
leaq 0x18cd(%rip), %rdi      # 0x3094
xorl %eax, %eax
callq 0x1050
movl 0x10(%rbx), %esi
leaq 0x18d0(%rip), %rdi      # 0x30a8
xorl %eax, %eax
callq 0x1050
movl 0x14(%rbx), %esi
leaq 0x18cc(%rip), %rdi      # 0x30b5
xorl %eax, %eax
callq 0x1050
movl 0x20(%rbx), %esi
leaq 0x18cb(%rip), %rdi      # 0x30c5
xorl %eax, %eax
callq 0x1050
movl 0x24(%rbx), %esi
leaq 0x18d6(%rip), %rdi      # 0x30e1
xorl %eax, %eax
callq 0x1050
movq 0x28(%rbx), %rsi
leaq 0x18d7(%rip), %rdi      # 0x30f4
xorl %eax, %eax
callq 0x1050
movl 0x18(%rbx), %esi
leaq 0x18d8(%rip), %rdi      # 0x3106
xorl %eax, %eax
popq %rbx
jmp 0x1050
// File: /workspace/github_cpp_makefile_star2_O2/DavieV[P]virtual-usb-printer/usbip.cc
// Function: print_standard_device_request(_StandardDeviceRequest const&)
void print_standard_device_request(const StandardDeviceRequest& request) {
  printf("  UC Request Type %u\n", request.bmRequestType);
  printf("  UC Request %u\n", request.bRequest);
  printf("  UC Value  %u[%u]\n", request.wValue1, request.wValue0);
  printf("  UC Index  %u-%u\n", request.wIndex1, request.wIndex0);
  printf("  UC Length %u\n", request.wLength);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movzbl (%rdi), %esi
leaq 0x18db(%rip), %rdi      # 0x311f
xorl %eax, %eax
callq 0x1050
movzbl 0x1(%rbx), %esi
leaq 0x18df(%rip), %rdi      # 0x3135
xorl %eax, %eax
callq 0x1050
movzbl 0x3(%rbx), %esi
movzbl 0x2(%rbx), %edx
leaq 0x18da(%rip), %rdi      # 0x3146
xorl %eax, %eax
callq 0x1050
movzbl 0x5(%rbx), %esi
movzbl 0x4(%rbx), %edx
leaq 0x18d8(%rip), %rdi      # 0x315a
xorl %eax, %eax
callq 0x1050
movzwl 0x6(%rbx), %esi
leaq 0x18d9(%rip), %rdi      # 0x316d
xorl %eax, %eax
popq %rbx
jmp 0x1050
// File: /workspace/github_cpp_makefile_star2_O2/DavieV[P]virtual-usb-printer/usbip.cc
// Function: create_usbip_ret_submit(_USBIP_CMD_SUBMIT const*)
USBIP_RET_SUBMIT create_usbip_ret_submit(const USBIP_CMD_SUBMIT *command) {
  USBIP_RET_SUBMIT usb_req;
  memset(&usb_req, 0, sizeof(usb_req));
  usb_req.seqnum = command->seqnum;
  usb_req.devid = command->devid;
  usb_req.direction = command->direction;
  usb_req.ep = command->ep;
  usb_req.setup = command->setup;
  return usb_req;
}

// Assembly:
movq %rdi, %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rdi)
movups %xmm0, (%rdi)
andq $0x0, 0x20(%rdi)
movups 0x4(%rsi), %xmm0
movups %xmm0, 0x4(%rdi)
movq 0x28(%rsi), %rcx
movq %rcx, 0x28(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O2/DavieV[P]virtual-usb-printer/usbip.cc
// Function: SendUsbRequest(int, _USBIP_CMD_SUBMIT const&, char const*, unsigned int, unsigned int)
void SendUsbRequest(int sockfd, const USBIP_CMD_SUBMIT& usb_request,
                    const char* data, unsigned int data_size,
                    unsigned int status) {
  USBIP_RET_SUBMIT response = CreateUsbipRetSubmit(usb_request);
  response.status = status;
  response.actual_length = data_size;
  response.start_frame = 0;
  // TODO(daviev): Figure out what this means.
  response.number_of_packets = 0;
  response.error_count = 0;

  if (data_size > 0) {
    printf("Sending buffer: \n");
    for (int i = 0; i < data_size; ++i) {
      printf("%u ", data[i]);
    }
    printf("\n");
  }

  size_t response_size = sizeof(response);
  pack_usbip((int*)&response, response_size);

  if (send(sockfd, (char*)&response, response_size, 0) != response_size) {
    printf("send error : %s \n", strerror(errno));
    exit(-1);
  }

  // Skip sending data if there isn't any.
  if (data_size == 0) {
    return;
  }

  if (send(sockfd, data, data_size, 0) != data_size) {
    printf("send error : %s \n", strerror(errno));
    exit(-1);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %ecx, %ebx
andq $0x0, 0x30(%rsp)
movl $0x3, 0x8(%rsp)
movups 0x4(%rsi), %xmm0
movups %xmm0, 0xc(%rsp)
movl %r8d, 0x1c(%rsp)
movl %ecx, 0x20(%rsp)
andq $0x0, 0x24(%rsp)
andl $0x0, 0x2c(%rsp)
movq %rdx, %r15
movl %edi, %ebp
movl %ecx, %r14d
testl %ecx, %ecx
je 0x195a
leaq 0x1872(%rip), %rdi      # 0x319c
callq 0x11e0
leaq 0x1847(%rip), %r12      # 0x317d
xorl %r13d, %r13d
cmpq %r13, %r14
je 0x1952
movsbl (%r15,%r13), %esi
movq %r12, %rdi
xorl %eax, %eax
callq 0x1050
incq %r13
jmp 0x1939
pushq $0xa
popq %rdi
callq 0x11c0
leaq 0x8(%rsp), %r12
pushq $0x30
popq %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x16dd
movl %ebp, %edi
movq %r12, %rsi
movq %r13, %rdx
xorl %ecx, %ecx
callq 0x10f0
cmpq $0x30, %rax
jne 0x19aa
testl %ebx, %ebx
je 0x199b
movl %ebp, %edi
movq %r15, %rsi
movq %r14, %rdx
xorl %ecx, %ecx
callq 0x10f0
cmpq %r14, %rax
jne 0x19aa
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1040
movl (%rax), %edi
callq 0x10b0
leaq 0x1681(%rip), %rdi      # 0x303e
movq %rax, %rsi
xorl %eax, %eax
callq 0x1050
pushq $-0x1
popq %rdi
callq 0x1190
nop
// File: /workspace/github_cpp_makefile_star2_O2/DavieV[P]virtual-usb-printer/usb_printer.cc
// Function: UsbPrinter::HandleUsbRequest(int, _USBIP_CMD_SUBMIT const&)
void UsbPrinter::HandleUsbRequest(int sockfd,
                                  const USBIP_CMD_SUBMIT& usb_request) {
  // Endpoint 0 is used for USB control requests.
  if (usb_request.ep == 0) {
    printf("# control requests\n");
    HandleUsbControl(sockfd, usb_request);
  } else {
    printf("# data requests\n");
  }
}

// Assembly:
cmpl $0x0, 0x10(%rdx)
je 0x1b90
leaq 0x1787(%rip), %rdi      # 0x3312
jmp 0x11e0
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
leaq 0x177f(%rip), %rdi      # 0x3322
callq 0x11e0
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rdx
popq %rbx
popq %r14
popq %rbp
jmp 0x1bba
nop
// File: /workspace/github_cpp_makefile_star2_O2/DavieV[P]virtual-usb-printer/usb_printer.cc
// Function: UsbPrinter::HandleUsbControl(int, _USBIP_CMD_SUBMIT const&)
void UsbPrinter::HandleUsbControl(int sockfd,
                                  const USBIP_CMD_SUBMIT& usb_request) {
  StandardDeviceRequest control_request =
      CreateStandardDeviceRequest(usb_request.setup);
  print_standard_device_request(control_request);
  int request_type = GetControlType(control_request.bmRequestType);
  switch (request_type) {
    case STANDARD_TYPE:
      HandleStandardControl(sockfd, usb_request, control_request);
      break;
    case CLASS_TYPE:
      HandlePrinterControl(sockfd, usb_request, control_request);
      break;
    case VENDOR_TYPE:
    case RESERVED_TYPE:
    default:
      printf("Unable to handle request of type %d\n", request_type);
      break;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
movq 0x28(%rdx), %rax
bswapq %rax
movq %rsp, %r15
movq %rax, (%r15)
movq %r15, %rdi
callq 0x1836
movl (%r15), %esi
shrl $0x5, %esi
andl $0x3, %esi
cmpl $0x1, %esi
je 0x1c02
testl %esi, %esi
jne 0x1c14
movq %rsp, %rcx
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x1c2e
jmp 0x1c22
movq %rsp, %rcx
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x1c60
jmp 0x1c22
leaq 0x15c5(%rip), %rdi      # 0x31e0
xorl %eax, %eax
callq 0x1050
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/DavieV[P]virtual-usb-printer/usb_printer.cc
// Function: UsbPrinter::HandleGetDescriptor(int, _USBIP_CMD_SUBMIT const&, _StandardDeviceRequest const&) const
void UsbPrinter::HandleGetDescriptor(
    int sockfd, const USBIP_CMD_SUBMIT& usb_request,
    const StandardDeviceRequest& control_request) const {
  printf("HandleGetDescriptor %u[%u]\n", control_request.wValue1,
         control_request.wValue0);

  switch (control_request.wValue1) {
    case USB_DESCRIPTOR_DEVICE:
      SendUsbRequest(sockfd, usb_request, (char*)&device_descriptor_,
                     device_descriptor_.bLength, 0);
      break;
    case USB_DESCRIPTOR_CONFIGURATION:
      HandleGetConfigurationDescriptor(sockfd, usb_request, control_request);
      break;
    case USB_DESCRIPTOR_STRING:
      HandleGetStringDescriptor(sockfd, usb_request, control_request);
      break;
    case USB_DESCRIPTOR_INTERFACE:
      break;
    case USB_DESCRIPTOR_ENDPOINT:
      break;
    case USB_DESCRIPTOR_DEVICE_QUALIFIER:
      break;
    default:
      printf("Unkown descriptor type requested: %d\n", control_request.wValue1);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rcx, %r14
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r15
movzbl 0x3(%rcx), %esi
movzbl 0x2(%rcx), %edx
leaq 0x1560(%rip), %rdi      # 0x3205
xorl %eax, %eax
callq 0x1050
movzbl 0x3(%r14), %esi
leal -0x1(%rsi), %eax
cmpl $0x5, %eax
ja 0x1cee
leaq 0x1508(%rip), %rcx      # 0x31c8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
movl %ebp, %esi
movq %rbx, %rdx
movq %r14, %rcx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1fce
leaq 0x152c(%rip), %rdi      # 0x3221
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1050
movzbl (%r15), %ecx
movl %ebp, %edi
movq %rbx, %rsi
movq %r15, %rdx
xorl %r8d, %r8d
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x18dc
movq %r15, %rdi
movl %ebp, %esi
movq %rbx, %rdx
movq %r14, %rcx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1e26
// File: /workspace/github_cpp_makefile_star2_O2/DavieV[P]virtual-usb-printer/usb_printer.cc
// Function: UsbPrinter::HandleGetConfiguration(int, _USBIP_CMD_SUBMIT const&, _StandardDeviceRequest const&)
void UsbPrinter::HandleGetConfiguration(
    int sockfd, const USBIP_CMD_SUBMIT& usb_request,
    const StandardDeviceRequest& control_request) {
  printf("HandleGetConfiguration %u[%u]\n", control_request.wValue1,
         control_request.wValue0);

  // Note: For now we only have on configuration set, so we just respond with
  // with |configuration_descriptor_.bConfigurationValue|.
  SendUsbRequest(sockfd, usb_request,
                 (const char*)&configuration_descriptor_.bConfigurationValue, 1,
                 0);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
movzbl 0x3(%rcx), %esi
movzbl 0x2(%rcx), %edx
leaq 0x1546(%rip), %rdi      # 0x329f
xorl %eax, %eax
callq 0x1050
addq $0x17, %r14
pushq $0x1
popq %rcx
movl %ebp, %edi
movq %rbx, %rsi
movq %r14, %rdx
xorl %r8d, %r8d
popq %rbx
popq %r14
popq %rbp
jmp 0x18dc
nop
// File: /workspace/github_cpp_makefile_star2_O2/DavieV[P]virtual-usb-printer/usb_printer.cc
// Function: UsbPrinter::HandleSetConfiguration(int, _USBIP_CMD_SUBMIT const&, _StandardDeviceRequest const&)
void UsbPrinter::HandleSetConfiguration(
    int sockfd, const USBIP_CMD_SUBMIT& usb_request,
    const StandardDeviceRequest& control_request) {
  printf("HandleSetConfiguration %u[%u]\n", control_request.wValue1,
         control_request.wValue0);

  // NOTE: For now we have only one configuration to set, so we just respond
  // with an empty message as a confirmation.
  SendUsbRequest(sockfd, usb_request, 0, 0, 0);
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl %esi, %ebp
movzbl 0x3(%rcx), %esi
movzbl 0x2(%rcx), %edx
leaq 0x152b(%rip), %rdi      # 0x32be
xorl %eax, %eax
callq 0x1050
movl %ebp, %edi
movq %rbx, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x18dc
nop
// File: /workspace/github_cpp_makefile_star2_O2/DavieV[P]virtual-usb-printer/usb_printer.cc
// Function: UsbPrinter::HandleSetInterface(int, _USBIP_CMD_SUBMIT const&, _StandardDeviceRequest const&)
void UsbPrinter::HandleSetInterface(
    int sockfd, const USBIP_CMD_SUBMIT& usb_request,
    const StandardDeviceRequest& control_request) {
  printf("HandleSetInterface %u[%u]\n", control_request.wValue1,
         control_request.wValue0);

  // NOTE: For now we have only one interface to set, so we just respond
  // with an empty message as a confirmation.
  SendUsbRequest(sockfd, usb_request, 0, 0, 0);
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl %esi, %ebp
movzbl 0x3(%rcx), %esi
movzbl 0x2(%rcx), %edx
leaq 0x1514(%rip), %rdi      # 0x32dd
xorl %eax, %eax
callq 0x1050
movl %ebp, %edi
movq %rbx, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x18dc
nop
// File: /workspace/github_cpp_makefile_star2_O2/DavieV[P]virtual-usb-printer/usb_printer.cc
// Function: UsbPrinter::HandleGetDeviceId(int, _USBIP_CMD_SUBMIT const&, _StandardDeviceRequest const&)
void UsbPrinter::HandleGetDeviceId(
    int sockfd, const USBIP_CMD_SUBMIT& usb_request,
    const StandardDeviceRequest& control_request) {
  printf("HandleGetDeviceId %u[%u]\n", control_request.wValue1,
         control_request.wValue0);

  SendUsbRequest(sockfd, usb_request, ieee_device_id_.data(),
                 ieee_device_id_.size(), 0);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
movzbl 0x3(%rcx), %esi
movzbl 0x2(%rcx), %edx
leaq 0x14f5(%rip), %rdi      # 0x32f8
xorl %eax, %eax
callq 0x1050
movq 0x38(%r14), %rdx
movl 0x40(%r14), %ecx
subl %edx, %ecx
movl %ebp, %edi
movq %rbx, %rsi
xorl %r8d, %r8d
popq %rbx
popq %r14
popq %rbp
jmp 0x18dc
nop
// File: /workspace/github_cpp_makefile_star2_O2/DavieV[P]virtual-usb-printer/usb_printer.cc
// Function: UsbPrinter::HandleGetStringDescriptor(int, _USBIP_CMD_SUBMIT const&, _StandardDeviceRequest const&) const
void UsbPrinter::HandleGetStringDescriptor(
    int sockfd, const USBIP_CMD_SUBMIT& usb_request,
    const StandardDeviceRequest& control_request) const {
  printf("HandleGetStringDescriptor %u[%u]\n", control_request.wValue1,
         control_request.wValue0);

  int index = control_request.wValue0;
  int string_length = (strings_[index][0] / 2) - 1;
  if (index != 0) {
    char str[255];
    memset(str, 0, 255);
    for (int i = 0; i < string_length; ++i) {
      str[i] = strings_[index][i * 2 + 2];
    }
    printf("String (%s)\n", str);
  }
  SendUsbRequest(sockfd, usb_request, strings_[index].data(),
                 strings_[index][0], 0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rcx, %r15
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
movzbl 0x3(%rcx), %esi
movzbl 0x2(%rcx), %edx
leaq 0x1277(%rip), %rdi      # 0x3270
xorl %eax, %eax
callq 0x1050
movzbl 0x2(%r15), %ecx
imulq $0x18, %rcx, %r13
movq 0x20(%r14), %rax
movq (%rax,%r13), %r15
movb (%r15), %al
testq %rcx, %rcx
je 0x2081
movq %rbx, 0x8(%rsp)
cbtw
movb $0x2, %cl
idivb %cl
movl %eax, %r12d
leaq 0x10(%rsp), %rdi
xorl %ebx, %ebx
movl $0xff, %edx
xorl %esi, %esi
callq 0x1110
movzbl %r12b, %eax
cmpb $0x2, %al
pushq $0x1
popq %rcx
cmovgel %eax, %ecx
decb %cl
movzbl %cl, %eax
cmpq %rbx, %rax
je 0x205e
movb 0x2(%r15,%rbx,2), %cl
movb %cl, 0x10(%rsp,%rbx)
incq %rbx
jmp 0x204b
leaq 0x122d(%rip), %rdi      # 0x3292
leaq 0x10(%rsp), %rsi
xorl %eax, %eax
callq 0x1050
movq 0x20(%r14), %rax
movq (%rax,%r13), %r15
movb (%r15), %al
movq 0x8(%rsp), %rbx
movsbl %al, %ecx
movl %ebp, %edi
movq %rbx, %rsi
movq %r15, %rdx
xorl %r8d, %r8d
callq 0x18dc
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/DavieV[P]virtual-usb-printer/server.cc
// Function: setup_server_socket()
int setup_server_socket() {
  int fd = socket(AF_INET, SOCK_STREAM, 0);
  if (fd < 0) {
    printf("socket error : %s\n", strerror(errno));
    exit(1);
  }

  int reuse = 1;
  if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse)) < 0) {
    perror("setsockopt(SO_REUSEADDR) failed");
  }

  return fd;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
pushq $0x2
popq %rdi
pushq $0x1
popq %rsi
xorl %edx, %edx
callq 0x1070
testl %eax, %eax
js 0x247e
movl %eax, %ebx
leaq 0xc(%rsp), %rcx
movl $0x1, (%rcx)
pushq $0x1
popq %rsi
pushq $0x2
popq %rdx
pushq $0x4
popq %r8
movl %eax, %edi
callq 0x1220
testl %eax, %eax
js 0x2470
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
leaq 0xf17(%rip), %rdi       # 0x338e
callq 0x1130
jmp 0x2468
callq 0x1040
movl (%rax), %edi
callq 0x10b0
leaq 0xeea(%rip), %rdi       # 0x337b
movq %rax, %rsi
xorl %eax, %eax
callq 0x1050
pushq $0x1
popq %rdi
callq 0x1190
// File: /workspace/github_cpp_makefile_star2_O2/DavieV[P]virtual-usb-printer/server.cc
// Function: bind_server_socket(int)
struct sockaddr_in bind_server_socket(int fd) {
  struct sockaddr_in server;
  memset(&server, 0, sizeof(server));
  server.sin_family = AF_INET;
  server.sin_addr.s_addr = htonl(INADDR_ANY);
  server.sin_port = htons(TCP_SERV_PORT);

  if (bind(fd, (sockaddr *)&server, sizeof(server)) < 0) {
    printf("bind error : %s \n", strerror(errno));
    exit(1);
  }

  return server;
}

// Assembly:
subq $0x18, %rsp
leaq 0x8(%rsp), %rsi
andq $0x0, 0x8(%rsi)
movl $0xa80c0002, %eax       # imm = 0xA80C0002
movq %rax, (%rsi)
pushq $0x10
popq %rdx
callq 0x1060
testl %eax, %eax
js 0x24d4
movq 0x8(%rsp), %rax
movq 0x10(%rsp), %rdx
addq $0x18, %rsp
retq
callq 0x1040
movl (%rax), %edi
callq 0x10b0
leaq 0xec7(%rip), %rdi       # 0x33ae
movq %rax, %rsi
xorl %eax, %eax
callq 0x1050
pushq $0x1
popq %rdi
callq 0x1190
// File: /workspace/github_cpp_makefile_star2_O2/DavieV[P]virtual-usb-printer/server.cc
// Function: accept_connection(int)
int accept_connection(int fd) {
  struct sockaddr_in client;
  socklen_t client_length = sizeof(client);
  int connection = accept(fd, (struct sockaddr *)&client, &client_length);
  if (connection < 0) {
    printf("accept error : %s\n", strerror(errno));
    exit(1);
  }
  printf("Connection address:%s\n", inet_ntoa(client.sin_addr));
  return connection;
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
leaq 0xc(%rsp), %rdx
movl $0x10, (%rdx)
leaq 0x10(%rsp), %rsi
callq 0x1090
testl %eax, %eax
js 0x253b
movl %eax, %ebx
movl 0x14(%rsp), %edi
callq 0x10e0
leaq 0xeaa(%rip), %rdi       # 0x33d3
movq %rax, %rsi
xorl %eax, %eax
callq 0x1050
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
retq
callq 0x1040
movl (%rax), %edi
callq 0x10b0
leaq 0xe72(%rip), %rdi       # 0x33c0
movq %rax, %rsi
xorl %eax, %eax
callq 0x1050
pushq $0x1
popq %rdi
callq 0x1190
// File: /workspace/github_cpp_makefile_star2_O2/AMDmi3[P]dangling_ptr/include/dangling_ptr.hh
// Function: dangling::ptr<Object>::operator=(dangling::ptr<Object> const&)
ptr<T>& operator=(const ptr<T>& other) {
		if (this == &other)
			return *this;
		reset(other.target_ ? *other.target_ : nullptr);
		return *this;
	}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpq %rsi, %rdi
je 0x61cc
movq (%rsi), %rax
testq %rax, %rax
je 0x61c2
movq (%rax), %rsi
jmp 0x61c4
xorl %esi, %esi
movq %rbx, %rdi
callq 0x6214
movq %rbx, %rax
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/AMDmi3[P]dangling_ptr/include/dangling_ptr.hh
// Function: dangling::ptr<Object>::operator=(dangling::ptr<Object>&&)
ptr<T>& operator=(ptr<T>&& other) noexcept {
		if (this == &other)
			return *this;
		if (target_ && *target_)
			(*target_)->unregister_ptr(target_.get());
		target_ = std::move(other.target_);
		return *this;
	}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq %rsi, %rdi
je 0x6201
movq %rsi, %r14
movq (%rbx), %rsi
testq %rsi, %rsi
je 0x61f6
movq (%rsi), %rdi
testq %rdi, %rdi
je 0x61f6
callq 0x6f3a
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7470
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rdi
callq 0x627c
// File: /workspace/github_cpp_makefile_star2_O2/AMDmi3[P]dangling_ptr/include/dangling_ptr.hh
// Function: dangling::ptr<Object>::reset(Object*)
void reset(T* target = nullptr) {
		if (get() == target)
			return;
		if (target) {
			if (!target_)
				target_.reset(new T*(nullptr));
			target->register_ptr(target_.get());
		}
		if (target_ && *target_)
			(*target_)->unregister_ptr(target_.get());
		*target_ = target;
	}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rsi
testq %rsi, %rsi
je 0x622b
movq (%rsi), %rax
jmp 0x622d
xorl %eax, %eax
cmpq %rbx, %rax
je 0x6274
testq %rbx, %rbx
je 0x6261
testq %rsi, %rsi
jne 0x6256
pushq $0x8
popq %rdi
callq 0x2160
andq $0x0, (%rax)
movq %r14, %rdi
movq %rax, %rsi
callq 0x7488
movq (%r14), %rsi
movq %rbx, %rdi
callq 0x6ea8
movq (%r14), %rsi
movq (%rsi), %rdi
testq %rdi, %rdi
je 0x6271
callq 0x6f3a
movq (%r14), %rsi
movq %rbx, (%rsi)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/AMDmi3[P]dangling_ptr/tests/testing.h
// Function: Tester::PrintSummary()
void PrintSummary() {
		std::cerr << num_failures_ << " failure(s) out of " << num_tests_ << " tests";
		if (unexpected_exception_)
			std::cerr << ", and was terminated prematurely due to unexpected exception";
		std::cerr << "\n";
	}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl 0x4(%rdi), %esi
movq 0x5d5a(%rip), %rdi      # 0xbff0
callq 0x2230
leaq 0x21f0(%rip), %rsi      # 0x8492
movq %rax, %rdi
callq 0x2150
movl (%rbx), %esi
movq %rax, %rdi
callq 0x2230
leaq 0x21eb(%rip), %rsi      # 0x84a6
movq %rax, %rdi
callq 0x2150
cmpb $0x1, 0x9(%rbx)
jne 0x62dc
movq 0x5d20(%rip), %rdi      # 0xbff0
leaq 0x21d6(%rip), %rsi      # 0x84ad
callq 0x2150
movq 0x5d0d(%rip), %rdi      # 0xbff0
leaq 0x2200(%rip), %rsi      # 0x84ea
popq %rbx
jmp 0x2150
// File: /workspace/github_cpp_makefile_star2_O2/AMDmi3[P]dangling_ptr/tests/testing.h
// Function: Tester::Stylify(Tester::Styles, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) const
std::string Stylify(Styles style, const std::string& str) const {
		if (!use_color_)
			return str;

		bool bright = false;
		int color = 0;

		switch (style) {
		case PASS_BANNER: bright = false; color = 2; break;
		case WARN_BANNER: bright =  true; color = 3; break;
		case FAIL_BANNER: bright =  true; color = 1; break;
		case LITERAL:     bright =  true; color = 5; break;
		case EXPRESSION:  bright =  true; color = 7; break;
		case DESCRIPTION: bright =  true; color = 4; break;
		default:
			return str;
		}

		std::ostringstream ss;
		ss << "\033[" << (bright ? '1' : '0') << ';' << (30 + color) << 'm' << str << "\033[0m";
		return ss.str();
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x180, %rsp            # imm = 0x180
movq %rcx, %r14
movq %rdi, %rbx
cmpb $0x0, 0x8(%rsi)
je 0x6982
movl %edx, %r15d
cmpl $0x6, %edx
jae 0x6982
movl %r15d, %eax
leaq 0x1e67(%rip), %rcx      # 0x8758
movl (%rcx,%rax,4), %ebp
leaq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0x21b0
leaq 0x1b58(%rip), %rsi      # 0x8460
movq %r12, %rdi
callq 0x2150
shll $0x3, %r15d
movabsq $0x313131313130, %rdx   # imm = 0x313131313130
movl %r15d, %ecx
shrq %cl, %rdx
movzbl %dl, %esi
movq %rax, %rdi
callq 0x2180
pushq $0x3b
popq %rsi
movq %rax, %rdi
callq 0x2180
movq %rax, %rdi
movl %ebp, %esi
callq 0x2230
pushq $0x6d
popq %rsi
movq %rax, %rdi
callq 0x2180
movq %rax, %rdi
movq %r14, %rsi
callq 0x2140
leaq 0x1b02(%rip), %rsi      # 0x8463
movq %rax, %rdi
callq 0x2150
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x21e0
leaq 0x8(%rsp), %rdi
callq 0x2040
jmp 0x698d
movq %rbx, %rdi
movq %r14, %rsi
callq 0x21c0
movq %rbx, %rax
addq $0x180, %rsp            # imm = 0x180
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2040
movq %rbx, %rdi
callq 0x2240
nop
// File: /workspace/github_cpp_makefile_star2_O2/AMDmi3[P]dangling_ptr/include/dangling_ptr.hh
// Function: dangling::target<Object>::register_ptr(Object**)
void register_ptr(T** ptr) {
#if defined(DANGLINGPTR_USE_LIST)
		assert(std::find(dangling_ptrs_.begin(), dangling_ptrs_.end(), ptr) == dangling_ptrs_.end());
		dangling_ptrs_.push_back(ptr);
#else
		assert(dangling_ptrs_.find(ptr) == dangling_ptrs_.end());
		dangling_ptrs_.insert(ptr);
#endif
	}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %rdx
movq %rsi, (%rdx)
movq 0x8(%rdi), %rdi
addq $0x8, %rbx
movq %rbx, %rsi
callq 0x6f23
cmpq %rbx, %rax
jne 0x6ee0
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x6f18
addq $0x10, %rsp
popq %rbx
retq
leaq 0x161d(%rip), %rdi      # 0x8504
leaq 0x166b(%rip), %rsi      # 0x8559
leaq 0x167c(%rip), %rcx      # 0x8571
pushq $0x4d
popq %rdx
callq 0x20f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/AMDmi3[P]dangling_ptr/include/dangling_ptr.hh
// Function: dangling::target<Object>::unregister_ptr(Object**)
void unregister_ptr(T** ptr) {
#if defined(DANGLINGPTR_USE_LIST)
		auto iter = std::find(dangling_ptrs_.begin(), dangling_ptrs_.end(), ptr);
		assert(iter != dangling_ptrs_.end());
		dangling_ptrs_.erase(iter);
#else
		auto iter = dangling_ptrs_.find(ptr);
		assert(iter != dangling_ptrs_.end());
		dangling_ptrs_.erase(iter);
#endif
	}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %rdx
movq %rsi, (%rdx)
movq 0x8(%rdi), %rdi
addq $0x8, %rbx
movq %rbx, %rsi
callq 0x6f23
cmpq %rbx, %rax
je 0x6f70
movq %rbx, %rdi
movq %rax, %rsi
callq 0x658e
addq $0x10, %rsp
popq %rbx
retq
leaq 0x1639(%rip), %rdi      # 0x85b0
leaq 0x15db(%rip), %rsi      # 0x8559
leaq 0x1648(%rip), %rcx      # 0x85cd
pushq $0x58
popq %rdx
callq 0x20f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/TwilioDevEd[P]twilio_cpp_demo/include/type_conversion.hh
// Function: utf8_to_ucs2(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
inline std::u16string
utf8_to_ucs2(std::string const& input)
{
        std::wstring_convert<std::codecvt_utf8<char16_t>, char16_t> convert;
        try {
                return convert.from_bytes(input);
        } catch(const std::range_error& e) {
                throw std::range_error(
                        "Failed UCS-2 conversion of message body.  Check all "
                        "characters are valid GSM-7, GSM 8-bit text, or UCS-2 "
                        "characters."
                );
        }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x60, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsp, %r15
movq %r15, %rdi
callq 0x3142
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x319c
movq %rsp, %rdi
callq 0x31b8
movq %rbx, %rax
addq $0x60, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
cmpl $0x1, %edx
jne 0x3061
movq %rbx, %rdi
callq 0x2050
pushq $0x10
popq %rdi
callq 0x2100
movq %rax, %r14
leaq 0x1359(%rip), %rsi      # 0x4387
movq %rax, %rdi
callq 0x2220
movq 0x3fb3(%rip), %rsi      # 0x6ff0
movq 0x3f6c(%rip), %rdx      # 0x6fb0
movq %r14, %rdi
callq 0x21b0
movq %rax, %rbx
jmp 0x305c
movq %rax, %rbx
movq %r14, %rdi
callq 0x2270
callq 0x2210
movq %rsp, %rdi
callq 0x31b8
movq %rbx, %rdi
callq 0x21c0
movq %rax, %rdi
callq 0x3136
nop
// File: /workspace/github_cpp_makefile_star2_O2/wichtounet[P]articles/src/threads/part4/AtomicCounter.cpp
// Function: main
int main(){
    AtomicCounter counter;

    std::vector<std::thread> threads;
    for(int i = 0; i < 10; ++i){
        threads.push_back(std::thread([&counter](){
            for(int i = 0; i < 500; ++i){
                counter.increment();
            }
        }));
    }

    for(auto& thread : threads){
        thread.join();
    }

    std::cout << counter.get() << std::endl;

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
leaq 0xc(%rsp), %rax
leaq 0x20(%rsp), %rbx
vxorps %xmm0, %xmm0, %xmm0
andl $0x0, (%rax)
andq $0x0, 0x10(%rbx)
vmovaps %xmm0, (%rbx)
pushq $0xa
popq %rbp
pushq $0x10
popq %r14
leaq 0x2b06(%rip), %r13      # 0x3d88
leaq 0x18(%rsp), %r15
leaq 0x10(%rsp), %r12
subl $0x1, %ebp
jb 0x12e2
andq $0x0, 0x18(%rsp)
movq %r14, %rdi
callq 0x10d0
leaq 0xc(%rsp), %rcx
movq %r13, (%rax)
movq %rax, 0x10(%rsp)
movq %rcx, 0x8(%rax)
movq %r15, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x10b0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x12cd
movq (%rdi), %rax
callq *0x8(%rax)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1404
movq %r15, %rdi
callq 0x1396
jmp 0x128c
movq 0x20(%rsp), %rbx
movq 0x28(%rsp), %r14
cmpq %r14, %rbx
je 0x12ff
movq %rbx, %rdi
callq 0x10f0
addq $0x8, %rbx
jmp 0x12ec
movl 0xc(%rsp), %esi
movq 0x2cce(%rip), %rdi      # 0x3fd8
callq 0x1100
movq %rax, %rdi
callq 0x1070
leaq 0x20(%rsp), %rdi
callq 0x13a4
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1336
jmp 0x1336
movq %rax, %rbx
jmp 0x135d
movq 0x10(%rsp), %rdi
movq %rax, %rbx
testq %rdi, %rdi
je 0x135d
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x135d
leaq 0x18(%rsp), %rdi
movq %rax, %rbx
callq 0x1396
leaq 0x20(%rsp), %rdi
callq 0x13a4
movq %rbx, %rdi
callq 0x1110
nop
// File: /workspace/github_cpp_makefile_star2_O2/cloudinary[P]fuif/encoding/context_predict.h
// Function: predict_and_compute_properties_with_precomputed_reference(std::vector<int, std::allocator<int>>&, Channel const&, int, int, int, Image const&, int, fuif_options&, Channel const&)
inline pixel_type predict_and_compute_properties_with_precomputed_reference(Properties &p, const Channel &ch, int x, int y, int predictor, const Image &image, int i, fuif_options &options, const Channel &references) {
    int offset;
    for (offset=0; offset<references.w; ) {
        p[offset] = references.value_nocheck(x,offset); offset++;
        p[offset] = references.value_nocheck(x,offset); offset++;
    }
    return predict_and_compute_properties(p,ch,x,y,predictor,offset);
}

// Assembly:
pushq %rbx
movq 0x20(%rsp), %rax
movq (%rax), %r10
movq (%rdi), %r11
xorl %r9d, %r9d
movslq 0x18(%rax), %rbx
cmpq %rbx, %r9
jge 0x488f
imull %edx, %ebx
addl %r9d, %ebx
movslq %ebx, %rbx
movswl (%r10,%rbx,2), %ebx
movl %ebx, (%r11,%r9,4)
movl 0x18(%rax), %ebx
imull %edx, %ebx
addl %r9d, %ebx
incl %ebx
movslq %ebx, %rbx
movswl (%r10,%rbx,2), %ebx
movl %ebx, 0x4(%r11,%r9,4)
addq $0x2, %r9
jmp 0x4856
popq %rbx
jmp 0x43eb
nop
// File: /workspace/github_cpp_makefile_star2_O2/cloudinary[P]fuif/encoding/../maniac/compound.h
// Function: FinalPropertySymbolCoder<SimpleBitChance, RacInput24<FileIO>, 15>::read_int(std::vector<int, std::allocator<int>> const&, int, int)
int read_int(const Properties &properties, int min, int max) ATTRIBUTE_HOT {
        if (min == max) { return min; }
        assert(properties.size() == nb_properties);
        FinalCompoundSymbolChances<BitChance,bits> &chances = find_leaf(properties);
        return coder.read_int(chances, min, max);
    }

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
cmpl %ecx, %edx
jne 0x48ed
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
movl %ecx, %ebx
movq %rdi, %r14
callq 0x4a5c
movq %r14, %rdi
movq %rax, %rsi
movl %ebp, %edx
movl %ebx, %ecx
popq %rbx
popq %r14
popq %rbp
jmp 0x16052
// File: /workspace/github_cpp_makefile_star2_O2/cloudinary[P]fuif/encoding/context_predict.h
// Function: predict_and_compute_properties_with_precomputed_reference_no_edge_case(std::vector<int, std::allocator<int>>&, Channel const&, int, int, Channel const&)
inline pixel_type predict_and_compute_properties_with_precomputed_reference_no_edge_case(Properties &p, const Channel &ch, int x, int y, const Channel &references) {
    int offset;
    for (offset=0; offset<references.w; ) {
        p[offset] = references.value_nocheck(x,offset); offset++;
        p[offset] = references.value_nocheck(x,offset); offset++;
    }
    return predict_and_compute_properties_no_edge_case(p,ch,x,y,offset);
}

// Assembly:
movq (%r8), %r9
movq (%rdi), %r10
xorl %eax, %eax
movslq 0x18(%r8), %r11
cmpq %r11, %rax
jge 0x494f
imull %edx, %r11d
addl %eax, %r11d
movslq %r11d, %r11
movswl (%r9,%r11,2), %r11d
movl %r11d, (%r10,%rax,4)
movl 0x18(%r8), %r11d
imull %edx, %r11d
addl %eax, %r11d
incl %r11d
movslq %r11d, %r11
movswl (%r9,%r11,2), %r11d
movl %r11d, 0x4(%r10,%rax,4)
addq $0x2, %rax
jmp 0x4912
movl %eax, %r8d
jmp 0x46ba