LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: DavieV[P]virtual-usb-printer/usb_printer.cc
// Function: UsbPrinter::HandleStandardControl(int, _USBIP_CMD_SUBMIT const&, _StandardDeviceRequest const&)
void UsbPrinter::HandleStandardControl(
    int sockfd, const USBIP_CMD_SUBMIT& usb_request,
    const StandardDeviceRequest& control_request) {
  switch (control_request.bRequest) {
    case GET_STATUS:
      break;
    case GET_DESCRIPTOR:
      HandleGetDescriptor(sockfd, usb_request, control_request);
      break;
    case SET_DESCRIPTOR:
      break;
    case GET_CONFIGURATION:
      HandleGetConfiguration(sockfd, usb_request, control_request);
      break;
    case SET_CONFIGURATION:
      HandleSetConfiguration(sockfd, usb_request, control_request);
      break;
    case GET_INTERFACE:
      // Support for this will be needed for interfaces with alt settings.
      break;
    case SET_INTERFACE:
      HandleSetInterface(sockfd, usb_request, control_request);
      break;
    default:
      break;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movzbl 0x1(%rax), %eax
movq %rax, -0x28(%rbp)
subq $0xb, %rax
ja 0x3ce3
movq -0x28(%rbp), %rax
leaq 0x5538(%rip), %rcx      # 0x91b4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
jmp 0x3ce5
movq -0x30(%rbp), %rdi
movl -0xc(%rbp), %esi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x3d70
jmp 0x3ce5
jmp 0x3ce5
movq -0x30(%rbp), %rdi
movl -0xc(%rbp), %esi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x3e40
jmp 0x3ce5
movq -0x30(%rbp), %rdi
movl -0xc(%rbp), %esi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x3eb0
jmp 0x3ce5
jmp 0x3ce5
movq -0x30(%rbp), %rdi
movl -0xc(%rbp), %esi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x3f10
jmp 0x3ce5
jmp 0x3ce5
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: DavieV[P]virtual-usb-printer/usb_printer.cc
// Function: UsbPrinter::HandlePrinterControl(int, _USBIP_CMD_SUBMIT const&, _StandardDeviceRequest const&)
void UsbPrinter::HandlePrinterControl(
    int sockfd, const USBIP_CMD_SUBMIT& usb_request,
    const StandardDeviceRequest& control_request) {
  switch (control_request.bRequest) {
    case GET_DEVICE_ID:
      HandleGetDeviceId(sockfd, usb_request, control_request);
      break;
    case GET_PORT_STATUS:
      break;
    case SOFT_RESET:
      break;
    default:
      printf("Unknown printer class request\n");
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movzbl 0x1(%rax), %eax
movl %eax, -0x24(%rbp)
testl %eax, %eax
je 0x3d34
jmp 0x3d20
movl -0x24(%rbp), %eax
subl $0x1, %eax
je 0x3d4a
jmp 0x3d2a
movl -0x24(%rbp), %eax
subl $0x2, %eax
je 0x3d4c
jmp 0x3d4e
movq -0x30(%rbp), %rdi
movl -0xc(%rbp), %esi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x3f70
jmp 0x3d5c
jmp 0x3d5c
jmp 0x3d5c
leaq 0x54f1(%rip), %rdi      # 0x9246
movb $0x0, %al
callq 0x2050
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movzbl 0x3(%rax), %esi
movzbl 0x2(%rax), %edx
leaq 0x54c3(%rip), %rdi      # 0x9265
xorl %eax, %eax
callq 0x2050
movq -0x20(%rbp), %rax
movzbl 0x3(%rax), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x28(%rbp)
subl $0x5, %eax
ja 0x3e1c
movq -0x28(%rbp), %rax
leaq 0x541b(%rip), %rcx      # 0x91e4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x30(%rbp), %rdx
movl -0xc(%rbp), %edi
movq -0x18(%rbp), %rsi
movzbl (%rdx), %ecx
xorl %r8d, %r8d
callq 0x2df0
jmp 0x3e32
movq -0x30(%rbp), %rdi
movl -0xc(%rbp), %esi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x4000
jmp 0x3e32
movq -0x30(%rbp), %rdi
movl -0xc(%rbp), %esi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x4260
jmp 0x3e32
jmp 0x3e32
jmp 0x3e32
jmp 0x3e32
movq -0x20(%rbp), %rax
movzbl 0x3(%rax), %esi
leaq 0x5456(%rip), %rdi      # 0x9281
movb $0x0, %al
callq 0x2050
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: 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
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movzbl 0x3(%rax), %esi
movq -0x20(%rbp), %rax
movzbl 0x2(%rax), %edx
leaq 0x54b2(%rip), %rdi      # 0x9328
movb $0x0, %al
callq 0x2050
movq -0x28(%rbp), %rdx
movl -0xc(%rbp), %edi
movq -0x18(%rbp), %rsi
addq $0x12, %rdx
addq $0x5, %rdx
movl $0x1, %ecx
xorl %r8d, %r8d
callq 0x2df0
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x20(%rbp), %rax
movzbl 0x3(%rax), %esi
movq -0x20(%rbp), %rax
movzbl 0x2(%rax), %edx
leaq 0x5469(%rip), %rdi      # 0x9347
movb $0x0, %al
callq 0x2050
movl -0xc(%rbp), %edi
movq -0x18(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
xorl %r8d, %r8d
movl %r8d, %ecx
callq 0x2df0
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movzbl 0x3(%rax), %esi
movq -0x20(%rbp), %rax
movzbl 0x2(%rax), %edx
leaq 0x53db(%rip), %rdi      # 0x9381
movb $0x0, %al
callq 0x2050
movq -0x40(%rbp), %rdi
movl -0xc(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
addq $0x38, %rdi
callq 0x4940
movq -0x40(%rbp), %rdi
movq %rax, -0x28(%rbp)
addq $0x38, %rdi
callq 0x4960
movl -0x34(%rbp), %edi
movq -0x30(%rbp), %rsi
movq -0x28(%rbp), %rdx
movl %eax, %ecx
xorl %r8d, %r8d
callq 0x2df0
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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
movq %rsp, %rbp
subq $0x160, %rsp            # imm = 0x160
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x140(%rbp)
movq -0x20(%rbp), %rax
movzbl 0x3(%rax), %esi
movq -0x20(%rbp), %rax
movzbl 0x2(%rax), %edx
leaq 0x505d(%rip), %rdi      # 0x92f9
movb $0x0, %al
callq 0x2050
movq -0x140(%rbp), %rdi
movq -0x20(%rbp), %rax
movzbl 0x2(%rax), %eax
movl %eax, -0x24(%rbp)
addq $0x20, %rdi
movslq -0x24(%rbp), %rsi
callq 0x48e0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4900
movsbl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
subl $0x1, %eax
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x4371
leaq -0x130(%rbp), %rdi
xorl %esi, %esi
movl $0xff, %edx
callq 0x2130
movl $0x0, -0x134(%rbp)
movl -0x134(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x435c
movq -0x140(%rbp), %rdi
addq $0x20, %rdi
movslq -0x24(%rbp), %rsi
callq 0x48e0
movq %rax, %rdi
movl -0x134(%rbp), %eax
shll %eax
addl $0x2, %eax
movslq %eax, %rsi
callq 0x4900
movb (%rax), %cl
movslq -0x134(%rbp), %rax
movb %cl, -0x130(%rbp,%rax)
movl -0x134(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x134(%rbp)
jmp 0x4306
leaq -0x130(%rbp), %rsi
leaq 0x4fb1(%rip), %rdi      # 0x931b
movb $0x0, %al
callq 0x2050
movq -0x140(%rbp), %rdi
movl -0xc(%rbp), %eax
movl %eax, -0x154(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x150(%rbp)
addq $0x20, %rdi
movslq -0x24(%rbp), %rsi
callq 0x48e0
movq %rax, %rdi
callq 0x4920
movq -0x140(%rbp), %rdi
movq %rax, -0x148(%rbp)
addq $0x20, %rdi
movslq -0x24(%rbp), %rsi
callq 0x48e0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4900
movl -0x154(%rbp), %edi
movq -0x150(%rbp), %rsi
movq -0x148(%rbp), %rdx
movsbl (%rax), %ecx
xorl %r8d, %r8d
callq 0x2df0
addq $0x160, %rsp            # imm = 0x160
popq %rbp
retq
// File: 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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x2, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x2090
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
jge 0x63a9
callq 0x2040
movl (%rax), %edi
callq 0x20d0
movq %rax, %rsi
leaq 0x3003(%rip), %rdi      # 0x939b
movb $0x0, %al
callq 0x2050
movl $0x1, %edi
callq 0x21f0
movl $0x1, -0x8(%rbp)
movl -0x4(%rbp), %edi
movl $0x1, %esi
movl $0x2, %edx
leaq -0x8(%rbp), %rcx
movl $0x4, %r8d
callq 0x2290
cmpl $0x0, %eax
jge 0x63dd
leaq 0x2fd6(%rip), %rdi      # 0x93ae
callq 0x2170
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x14(%rbp)
leaq -0x10(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x2130
movw $0x2, -0x10(%rbp)
xorl %edi, %edi
callq 0x2150
movl %eax, -0xc(%rbp)
movl $0xca8, %edi            # imm = 0xCA8
callq 0x2060
movw %ax, -0xe(%rbp)
movl -0x14(%rbp), %edi
leaq -0x10(%rbp), %rsi
movl $0x10, %edx
callq 0x2070
cmpl $0x0, %eax
jge 0x6466
callq 0x2040
movl (%rax), %edi
callq 0x20d0
movq %rax, %rsi
leaq 0x2f79(%rip), %rdi      # 0x93ce
movb $0x0, %al
callq 0x2050
movl $0x1, %edi
callq 0x21f0
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rdx
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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 %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
movl $0x10, -0x18(%rbp)
movl -0x4(%rbp), %edi
leaq -0x14(%rbp), %rsi
leaq -0x18(%rbp), %rdx
callq 0x20b0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jge 0x64d2
callq 0x2040
movl (%rax), %edi
callq 0x20d0
movq %rax, %rsi
leaq 0x2f1f(%rip), %rdi      # 0x93e0
movb $0x0, %al
callq 0x2050
movl $0x1, %edi
callq 0x21f0
movl -0x10(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %edi
callq 0x2100
movq %rax, %rsi
leaq 0x2f09(%rip), %rdi      # 0x93f3
movb $0x0, %al
callq 0x2050
movl -0x1c(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: 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 %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq -0x18(%rbp), %rax
jne 0xd4e8
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xd526
movq -0x18(%rbp), %rdi
callq 0x105f0
testb $0x1, %al
jne 0xd4f7
jmp 0xd509
movq -0x18(%rbp), %rdi
callq 0x10130
movq (%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0xd511
xorl %eax, %eax
movq %rax, -0x28(%rbp)
jmp 0xd511
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0xd5d0
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
// File: 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 %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq -0x18(%rbp), %rax
jne 0xd558
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xd5b4
movq -0x20(%rbp), %rdi
callq 0x105f0
testb $0x1, %al
jne 0xd567
jmp 0xd59f
movq -0x20(%rbp), %rdi
callq 0x10130
cmpq $0x0, (%rax)
je 0xd59f
movq -0x20(%rbp), %rdi
callq 0x10130
movq -0x20(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x28(%rbp)
callq 0x10100
movq -0x28(%rbp), %rdi
movq %rax, %rsi
callq 0x10620
jmp 0xd59d
jmp 0xd59f
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x11280
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
movq %rax, %rdi
callq 0xd6d0
nopw %cs:(%rax,%rax)
// File: 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 %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x18(%rbp)
callq 0xce20
cmpq -0x10(%rbp), %rax
jne 0xd5f8
jmp 0xd6a1
cmpq $0x0, -0x10(%rbp)
je 0xd646
movq -0x18(%rbp), %rdi
callq 0x105f0
testb $0x1, %al
jne 0xd629
movl $0x8, %edi
callq 0x31f0
movq -0x18(%rbp), %rdi
movq %rax, %rsi
movq $0x0, (%rsi)
callq 0x113d0
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
callq 0x10100
movq -0x20(%rbp), %rdi
movq %rax, %rsi
callq 0x10050
movq -0x18(%rbp), %rdi
callq 0x105f0
testb $0x1, %al
jne 0xd655
jmp 0xd689
movq -0x18(%rbp), %rdi
callq 0x10130
cmpq $0x0, (%rax)
je 0xd689
movq -0x18(%rbp), %rdi
callq 0x10130
movq -0x18(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x28(%rbp)
callq 0x10100
movq -0x28(%rbp), %rdi
movq %rax, %rsi
callq 0x10620
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
callq 0x10130
movq -0x30(%rbp), %rcx
movq %rcx, (%rax)
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: 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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movl 0x4(%rax), %esi
movq 0xa8f2(%rip), %rdi      # 0x17ff0
callq 0x3350
movq %rax, %rdi
leaq 0x4de3(%rip), %rsi      # 0x124f0
callq 0x31e0
movq %rax, %rdi
movq -0x10(%rbp), %rax
movl (%rax), %esi
callq 0x3350
movq %rax, %rdi
leaq 0x4dda(%rip), %rsi      # 0x12504
callq 0x31e0
movq -0x10(%rbp), %rax
testb $0x1, 0x9(%rax)
je 0xd74c
movq 0xa8b0(%rip), %rdi      # 0x17ff0
leaq 0x4dc4(%rip), %rsi      # 0x1250b
callq 0x31e0
movq 0xa89d(%rip), %rdi      # 0x17ff0
leaq 0x4dee(%rip), %rsi      # 0x12548
callq 0x31e0
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: 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
movq %rsp, %rbp
subq $0x200, %rsp            # imm = 0x200
movq %rdi, -0x1c0(%rbp)
movq %rdi, %rax
movq %rax, -0x1b8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x10(%rbp), %rax
testb $0x1, 0x8(%rax)
jne 0xf1fa
movq -0x1c0(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x30b0
jmp 0xf39d
movb $0x0, -0x21(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x14(%rbp), %eax
movq %rax, -0x1c8(%rbp)
subq $0x5, %rax
ja 0xf27a
movq -0x1c8(%rbp), %rax
leaq 0x2de1(%rip), %rcx      # 0x12004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movb $0x0, -0x21(%rbp)
movl $0x2, -0x28(%rbp)
jmp 0xf28f
movb $0x1, -0x21(%rbp)
movl $0x3, -0x28(%rbp)
jmp 0xf28f
movb $0x1, -0x21(%rbp)
movl $0x1, -0x28(%rbp)
jmp 0xf28f
movb $0x1, -0x21(%rbp)
movl $0x5, -0x28(%rbp)
jmp 0xf28f
movb $0x1, -0x21(%rbp)
movl $0x7, -0x28(%rbp)
jmp 0xf28f
movb $0x1, -0x21(%rbp)
movl $0x4, -0x28(%rbp)
jmp 0xf28f
movq -0x1c0(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x30b0
jmp 0xf39d
leaq -0x1a0(%rbp), %rdi
movq %rdi, -0x1d8(%rbp)
callq 0x32b0
movq -0x1d8(%rbp), %rdi
leaq 0x3238(%rip), %rsi      # 0x124e8
callq 0x31e0
movq %rax, -0x1d0(%rbp)
jmp 0xf2be
movq -0x1d0(%rbp), %rdi
movzbl -0x21(%rbp), %esi
andl $0x1, %esi
orl $0x30, %esi
callq 0x3270
movq %rax, -0x1e0(%rbp)
jmp 0xf2dd
movq -0x1e0(%rbp), %rdi
movl $0x3b, %esi
callq 0x3270
movq %rax, -0x1e8(%rbp)
jmp 0xf2f7
movq -0x1e8(%rbp), %rdi
movl -0x28(%rbp), %esi
addl $0x1e, %esi
callq 0x3350
movq %rax, -0x1f0(%rbp)
jmp 0xf312
movq -0x1f0(%rbp), %rdi
movl $0x6d, %esi
callq 0x3270
movq %rax, -0x1f8(%rbp)
jmp 0xf32c
movq -0x1f8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x31d0
movq %rax, -0x200(%rbp)
jmp 0xf345
movq -0x200(%rbp), %rdi
leaq 0x3198(%rip), %rsi      # 0x124eb
callq 0x31e0
jmp 0xf35a
movq -0x1c0(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x3210
jmp 0xf36f
leaq -0x1a0(%rbp), %rdi
callq 0x3060
jmp 0xf39d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0x3060
jmp 0xf3ad
movq -0x1b8(%rbp), %rax
addq $0x200, %rsp            # imm = 0x200
popq %rbp
retq
movq -0x1a8(%rbp), %rdi
callq 0x3360
nopl (%rax)
// File: 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 %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x48(%rbp)
addq $0x8, %rdi
callq 0xd9f0
movq -0x48(%rbp), %rdi
movq %rax, -0x20(%rbp)
addq $0x8, %rdi
callq 0xda20
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
leaq -0x10(%rbp), %rdx
callq 0x10260
movq -0x48(%rbp), %rdi
movq %rax, -0x18(%rbp)
addq $0x8, %rdi
callq 0xda20
movq %rax, -0x30(%rbp)
leaq -0x18(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0xda50
testb $0x1, %al
jne 0x1068f
jmp 0x10691
jmp 0x106b0
leaq 0x1fa0(%rip), %rdi      # 0x12638
leaq 0x1f42(%rip), %rsi      # 0x125e1
movl $0x58, %edx
leaq 0x1faa(%rip), %rcx      # 0x12655
callq 0x3140
movq -0x48(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x50(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0xe6f0
movq -0x50(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0xe800
movq %rax, -0x40(%rbp)
addq $0x50, %rsp
popq %rbp
retq
// File: TwilioDevEd[P]twilio_cpp_demo/src/twilio.cc
// Function: twilio::Twilio::_stream_write(char*, unsigned long, unsigned long, void*)
size_t Twilio::_stream_write(
        char *ptr,
        size_t size,
        size_t nmemb,
        void *userdata) 
{
        size_t response_size = size * nmemb;
        std::stringstream *ss = (std::stringstream*)userdata;
        ss->write(ptr, response_size);
        return response_size;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x10(%rbp), %rax
imulq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
addq $0x10, %rdi
movq -0x8(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x31d0
movq -0x28(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: 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 %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x98(%rbp)
movq %rdi, %rax
movq %rax, -0xa0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x70(%rbp), %rdi
movq %rdi, -0x90(%rbp)
callq 0x5460
movq -0x98(%rbp), %rdi
movq -0x90(%rbp), %rsi
movq -0x10(%rbp), %rdx
callq 0x5510
jmp 0x511d
leaq -0x70(%rbp), %rdi
callq 0x5580
movq -0xa0(%rbp), %rax
addq $0xb0, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x51d2
movq -0x78(%rbp), %rdi
callq 0x3050
movq %rax, -0x88(%rbp)
movl $0x10, %edi
callq 0x3180
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xa8(%rbp)
leaq 0x32a7(%rip), %rsi      # 0x8427
callq 0x3290
jmp 0x5187
movq -0xa8(%rbp), %rdi
movq 0x6e53(%rip), %rsi      # 0xbfe8
movq 0x6e04(%rip), %rdx      # 0xbfa0
callq 0x3210
jmp 0x51ec
movq -0xa8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
callq 0x32e0
jmp 0x51c9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
callq 0x3280
jmp 0x51d0
jmp 0x51d2
leaq -0x70(%rbp), %rdi
callq 0x5580
movq -0x78(%rbp), %rdi
callq 0x3220
movq %rax, %rdi
callq 0x3ce0
nopl (%rax)
// File: 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:
subq $0x78, %rsp
movl $0x0, 0x74(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x1710
leaq 0x58(%rsp), %rdi
callq 0x1730
movl $0x0, 0x54(%rsp)
cmpl $0xa, 0x54(%rsp)
jge 0x1302
leaq 0x70(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0x48(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x13d0
jmp 0x12aa
leaq 0x58(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x1740
jmp 0x12bb
leaq 0x48(%rsp), %rdi
callq 0x1770
movl 0x54(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x54(%rsp)
jmp 0x1288
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x38(%rsp)
movl %eax, 0x34(%rsp)
jmp 0x13bb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x38(%rsp)
movl %eax, 0x34(%rsp)
leaq 0x48(%rsp), %rdi
callq 0x1770
jmp 0x13bb
leaq 0x58(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rdi
callq 0x1790
movq %rax, 0x20(%rsp)
movq 0x28(%rsp), %rdi
callq 0x17c0
movq %rax, 0x18(%rsp)
leaq 0x20(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x17f0
testb $0x1, %al
jne 0x133f
jmp 0x1368
leaq 0x20(%rsp), %rdi
callq 0x1830
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rdi
callq 0x10f0
jmp 0x135a
jmp 0x135c
leaq 0x20(%rsp), %rdi
callq 0x1840
jmp 0x132a
leaq 0x70(%rsp), %rdi
callq 0x1860
movl %eax, 0xc(%rsp)
jmp 0x1378
movl 0xc(%rsp), %esi
movq 0x4c55(%rip), %rdi      # 0x5fd8
callq 0x1100
movq %rax, (%rsp)
jmp 0x138e
movq (%rsp), %rdi
movq 0x4c27(%rip), %rsi      # 0x5fc0
callq 0x10d0
jmp 0x13a0
movl $0x0, 0x74(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x1900
movl 0x74(%rsp), %eax
addq $0x78, %rsp
retq
leaq 0x58(%rsp), %rdi
callq 0x1900
movq 0x38(%rsp), %rdi
callq 0x1110
nop
// File: cloudinary[P]fuif/image/image.cpp
// Function: colorprofile_name(int)
const char * colorprofile_name(int colormodel) {
    if (colormodel>>4) {
        return ""; // TODO: define some common non-RGB profiles
    } else {
        // common RGB profiles
        switch (colormodel & 0xF) {
            case 1: return " (DCI-P3)";
            case 2: return " (Rec.2020)";
            case 3: return " (Adobe RGB 1998)";
            case 4: return " (ProPhoto)";
            case 0:
            default: return " (sRGB)";
        }
    }
}

// Assembly:
movl %edi, -0xc(%rsp)
movl -0xc(%rsp), %eax
sarl $0x4, %eax
cmpl $0x0, %eax
je 0x439e
leaq 0x44517(%rip), %rax     # 0x488ae
movq %rax, -0x8(%rsp)
jmp 0x440c
movl -0xc(%rsp), %eax
andl $0xf, %eax
movl %eax, %ecx
movq %rcx, -0x18(%rsp)
subl $0x4, %eax
ja 0x4400
movq -0x18(%rsp), %rax
leaq 0x41c67(%rip), %rcx     # 0x46024
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x41d06(%rip), %rax     # 0x460d3
movq %rax, -0x8(%rsp)
jmp 0x440c
leaq 0x41d02(%rip), %rax     # 0x460dd
movq %rax, -0x8(%rsp)
jmp 0x440c
leaq 0x41d00(%rip), %rax     # 0x460e9
movq %rax, -0x8(%rsp)
jmp 0x440c
leaq 0x41d04(%rip), %rax     # 0x460fb
movq %rax, -0x8(%rsp)
jmp 0x440c
jmp 0x4400
leaq 0x41d00(%rip), %rax     # 0x46107
movq %rax, -0x8(%rsp)
movq -0x8(%rsp), %rax
retq
nopw %cs:(%rax,%rax)
// File: cloudinary[P]fuif/image/image.cpp
// Function: Channel::actual_minmax(short*, short*) const
void Channel::actual_minmax(pixel_type *min, pixel_type *max) const {
    pixel_type realmin=LARGEST_VAL;
    pixel_type realmax=SMALLEST_VAL;
    for (int i=0; i<data.size(); i++) {
        if (data[i] < realmin) realmin = data[i];
        if (data[i] > realmax) realmax = data[i];
    }
    *min = realmin;
    *max = realmax;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdx, 0x20(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movw $0x7fff, 0x1e(%rsp)     # imm = 0x7FFF
movw $0x8001, 0x1c(%rsp)     # imm = 0x8001
movl $0x0, 0x18(%rsp)
movq 0x10(%rsp), %rdi
movslq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
callq 0x4a30
movq %rax, %rcx
movq 0x8(%rsp), %rax
cmpq %rcx, %rax
jae 0x44ea
movq 0x10(%rsp), %rdi
movslq 0x18(%rsp), %rsi
callq 0x4a50
movswl (%rax), %eax
movswl 0x1e(%rsp), %ecx
cmpl %ecx, %eax
jge 0x44a6
movq 0x10(%rsp), %rdi
movslq 0x18(%rsp), %rsi
callq 0x4a50
movw (%rax), %ax
movw %ax, 0x1e(%rsp)
movq 0x10(%rsp), %rdi
movslq 0x18(%rsp), %rsi
callq 0x4a50
movswl (%rax), %eax
movswl 0x1c(%rsp), %ecx
cmpl %ecx, %eax
jle 0x44d8
movq 0x10(%rsp), %rdi
movslq 0x18(%rsp), %rsi
callq 0x4a50
movw (%rax), %ax
movw %ax, 0x1c(%rsp)
jmp 0x44da
movl 0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
jmp 0x4453
movw 0x1e(%rsp), %cx
movq 0x28(%rsp), %rax
movw %cx, (%rax)
movw 0x1c(%rsp), %cx
movq 0x20(%rsp), %rax
movw %cx, (%rax)
addq $0x38, %rsp
retq
nopl (%rax)
// File: cloudinary[P]fuif/image/image.cpp
// Function: Image::do_transform(Transform const&)
bool Image::do_transform(const Transform &tr) {
    Transform t = tr;
    bool did_it = t.apply(*this, false);
    if (did_it) transform.push_back(t);
    return did_it;
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x60(%rsp)
movq %rsi, 0x58(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x58(%rsp), %rsi
leaq 0x38(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x4ad0
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
xorl %edx, %edx
callq 0x11d80
movb %al, 0x23(%rsp)
jmp 0x4843
movb 0x23(%rsp), %al
andb $0x1, %al
movb %al, 0x37(%rsp)
testb $0x1, 0x37(%rsp)
je 0x4885
movq 0x18(%rsp), %rdi
addq $0x18, %rdi
leaq 0x38(%rsp), %rsi
callq 0x4be0
jmp 0x4869
jmp 0x4885
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x28(%rsp)
movl %eax, 0x24(%rsp)
leaq 0x38(%rsp), %rdi
callq 0x4b60
jmp 0x48a2
movb 0x37(%rsp), %al
movb %al, 0xf(%rsp)
leaq 0x38(%rsp), %rdi
callq 0x4b60
movb 0xf(%rsp), %al
andb $0x1, %al
addq $0x68, %rsp
retq
movq 0x28(%rsp), %rdi
callq 0x36a0
nopl (%rax)
// File: cloudinary[P]fuif/image/image.cpp
// Function: Image::recompute_downscales()
void Image::recompute_downscales() {
    downscales[0] = nb_meta_channels + nb_channels -1; // we have an LQIP when each component has had its first scan
    for (int s=1; s<6; s++) {
        downscales[s] = channel.size()-1;
        for (int k=downscales[s-1]; k<channel.size(); k++) {
            // has to be possible to decode downscaled image with a buffer the size of the final image, so once we need a larger buffer, we went too far
            if ((1<<channel[k].hcshift) < RESPONSIVE_SIZE(s) || (1<<channel[k].vcshift) < RESPONSIVE_SIZE(s)) break;

            // all channels should ideally be available in the required size (though chroma subsampling may cause this to be not true)
            if ((1<<channel[k].hcshift) == RESPONSIVE_SIZE(s) && (1<<channel[k].vcshift) == RESPONSIVE_SIZE(s)) downscales[s] = k;
        }
    }
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movl 0x6c(%rax), %ecx
addl 0x64(%rax), %ecx
subl $0x1, %ecx
movl %ecx, 0x90(%rax)
movl $0x1, 0x1c(%rsp)
cmpl $0x6, 0x1c(%rsp)
jge 0x4a26
movq 0x10(%rsp), %rdi
callq 0x4b80
movq %rax, %rcx
movq 0x10(%rsp), %rax
subq $0x1, %rcx
movl %ecx, %edx
movslq 0x1c(%rsp), %rcx
movl %edx, 0x90(%rax,%rcx,4)
movl 0x1c(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl 0x90(%rax,%rcx,4), %eax
movl %eax, 0x18(%rsp)
movq 0x10(%rsp), %rdi
movslq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
callq 0x4b80
movq %rax, %rcx
movq 0x8(%rsp), %rax
cmpq %rcx, %rax
jae 0x4a14
movq 0x10(%rsp), %rdi
movslq 0x18(%rsp), %rsi
callq 0x4ba0
movl 0x34(%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movl 0x1c(%rsp), %ecx
movl $0x20, %edx
sarl %cl, %edx
movl %edx, %ecx
cmpl %ecx, %eax
jl 0x4997
movq 0x10(%rsp), %rdi
movslq 0x18(%rsp), %rsi
callq 0x4ba0
movl 0x38(%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movl 0x1c(%rsp), %ecx
movl $0x20, %edx
sarl %cl, %edx
movl %edx, %ecx
cmpl %ecx, %eax
jge 0x4999
jmp 0x4a14
movq 0x10(%rsp), %rdi
movslq 0x18(%rsp), %rsi
callq 0x4ba0
movl 0x34(%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movl 0x1c(%rsp), %ecx
movl $0x20, %edx
sarl %cl, %edx
movl %edx, %ecx
cmpl %ecx, %eax
jne 0x4a02
movq 0x10(%rsp), %rdi
movslq 0x18(%rsp), %rsi
callq 0x4ba0
movl 0x38(%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movl 0x1c(%rsp), %ecx
movl $0x20, %edx
sarl %cl, %edx
movl %edx, %ecx
cmpl %ecx, %eax
jne 0x4a02
movq 0x10(%rsp), %rax
movl 0x18(%rsp), %edx
movslq 0x1c(%rsp), %rcx
movl %edx, 0x90(%rax,%rcx,4)
jmp 0x4a04
movl 0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
jmp 0x491e
jmp 0x4a16
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x48da
addq $0x28, %rsp
retq
nopl (%rax,%rax)
// File: cloudinary[P]fuif/transform/dct.h
// Function: DCT1d(double const*, int, double*)
void DCT1d(const double* in, int stride, double* out) {
  for (int x = 0; x < 8; ++x) {
    out[x * stride] = 0.0;
    for (int u = 0; u < 8; ++u) {
      out[x * stride] += kDCTMatrix[8 * x + u] * in[u * stride];
    }
  }
}

// Assembly:
movq %rdi, -0x8(%rsp)
movl %esi, -0xc(%rsp)
movq %rdx, -0x18(%rsp)
movl $0x0, -0x1c(%rsp)
cmpl $0x8, -0x1c(%rsp)
jge 0x7fab
movq -0x18(%rsp), %rax
movl -0x1c(%rsp), %ecx
imull -0xc(%rsp), %ecx
movslq %ecx, %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl $0x0, -0x20(%rsp)
cmpl $0x8, -0x20(%rsp)
jge 0x7f99
movl -0x1c(%rsp), %eax
shll $0x3, %eax
addl -0x20(%rsp), %eax
movslq %eax, %rcx
leaq 0x3e312(%rip), %rax     # 0x46260
movsd (%rax,%rcx,8), %xmm0
movq -0x8(%rsp), %rax
movl -0x20(%rsp), %ecx
imull -0xc(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm2
movq -0x18(%rsp), %rax
movl -0x1c(%rsp), %ecx
imull -0xc(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rsp)
jmp 0x7f32
jmp 0x7f9b
movl -0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rsp)
jmp 0x7f06
retq
nopl (%rax)
// File: cloudinary[P]fuif/transform/dct.h
// Function: IDCT1d(double const*, int, double*)
void IDCT1d(const double* in, int stride, double* out) {
  for (int x = 0; x < 8; ++x) {
    out[x * stride] = 0.0;
    for (int u = 0; u < 8; ++u) {
      out[x * stride] += kDCTMatrix[8 * u + x] * in[u * stride];
    }
  }
}

// Assembly:
movq %rdi, -0x8(%rsp)
movl %esi, -0xc(%rsp)
movq %rdx, -0x18(%rsp)
movl $0x0, -0x1c(%rsp)
cmpl $0x8, -0x1c(%rsp)
jge 0x806b
movq -0x18(%rsp), %rax
movl -0x1c(%rsp), %ecx
imull -0xc(%rsp), %ecx
movslq %ecx, %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl $0x0, -0x20(%rsp)
cmpl $0x8, -0x20(%rsp)
jge 0x8059
movl -0x20(%rsp), %eax
shll $0x3, %eax
addl -0x1c(%rsp), %eax
movslq %eax, %rcx
leaq 0x3e252(%rip), %rax     # 0x46260
movsd (%rax,%rcx,8), %xmm0
movq -0x8(%rsp), %rax
movl -0x20(%rsp), %ecx
imull -0xc(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm2
movq -0x18(%rsp), %rax
movl -0x1c(%rsp), %ecx
imull -0xc(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rsp)
jmp 0x7ff2
jmp 0x805b
movl -0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rsp)
jmp 0x7fc6
retq
nopl (%rax)
// File: cloudinary[P]fuif/transform/dct.h
// Function: TransformBlock(double*, void (*)(double const*, int, double*))
void TransformBlock(double block[64], Transform1d f) {
  double tmp[64];
  for (int x = 0; x < 8; ++x) {
    f(&block[x], 8, &tmp[x]);
  }
  for (int y = 0; y < 8; ++y) {
    f(&tmp[8 * y], 1, &block[8 * y]);
  }
}

// Assembly:
subq $0x228, %rsp            # imm = 0x228
movq %rdi, 0x220(%rsp)
movq %rsi, 0x218(%rsp)
movl $0x0, 0xc(%rsp)
cmpl $0x8, 0xc(%rsp)
jge 0x80d7
movq 0x218(%rsp), %rax
movq 0x220(%rsp), %rdi
movslq 0xc(%rsp), %rcx
shlq $0x3, %rcx
addq %rcx, %rdi
movslq 0xc(%rsp), %rcx
leaq 0x10(%rsp), %rdx
shlq $0x3, %rcx
addq %rcx, %rdx
movl $0x8, %esi
callq *%rax
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x808f
movl $0x0, 0x8(%rsp)
cmpl $0x8, 0x8(%rsp)
jge 0x8131
movq 0x218(%rsp), %rax
movl 0x8(%rsp), %ecx
shll $0x3, %ecx
movslq %ecx, %rcx
leaq 0x10(%rsp), %rdi
shlq $0x3, %rcx
addq %rcx, %rdi
movq 0x220(%rsp), %rdx
movl 0x8(%rsp), %ecx
shll $0x3, %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rdx
movl $0x1, %esi
callq *%rax
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x80df
addq $0x228, %rsp            # imm = 0x228
retq
nopl (%rax)
// File: cloudinary[P]fuif/transform/quantize.h
// Function: inv_quantize(Image&, std::vector<int, std::allocator<int>> const&)
bool inv_quantize(Image &input, const std::vector<int> &parameters) {
    for (int c=input.nb_meta_channels; c<input.channel.size(); c++) {
        Channel &ch = input.channel[c];
        if (ch.data.size() == 0) continue;
        int q = ch.q;
        if (q == 1) continue;
        v_printf(3,"De-quantizing channel %i with quantization constant %i\n",c,q);
        for (int y=0; y<ch.h; y++) {
          for (int x=0; x<ch.w; x++) {
            ch.value(y,x) *= q;
          }
        }
        ch.minval *= q;
        ch.maxval *= q;
        ch.q = 1;
    }
    return true;
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
movq 0x40(%rsp), %rax
movl 0x6c(%rax), %eax
movl %eax, 0x34(%rsp)
movslq 0x34(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x40(%rsp), %rdi
callq 0x4b80
movq %rax, %rcx
movq 0x10(%rsp), %rax
cmpq %rcx, %rax
jae 0x9a5e
movq 0x40(%rsp), %rdi
movslq 0x34(%rsp), %rsi
callq 0x4ba0
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rdi
callq 0x4a30
cmpq $0x0, %rax
jne 0x9978
jmp 0x9a4e
movq 0x28(%rsp), %rax
movl 0x28(%rax), %eax
movl %eax, 0x24(%rsp)
cmpl $0x1, 0x24(%rsp)
jne 0x9990
jmp 0x9a4e
movl 0x34(%rsp), %edx
movl 0x24(%rsp), %ecx
movl $0x3, %edi
leaq 0x3cf59(%rip), %rsi     # 0x468fd
movb $0x0, %al
callq 0x3a770
movl $0x0, 0x20(%rsp)
movl 0x20(%rsp), %eax
movq 0x28(%rsp), %rcx
cmpl 0x1c(%rcx), %eax
jge 0x9a1a
movl $0x0, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
movq 0x28(%rsp), %rcx
cmpl 0x18(%rcx), %eax
jge 0x9a0b
movl 0x24(%rsp), %eax
movl %eax, 0xc(%rsp)
movq 0x28(%rsp), %rdi
movl 0x20(%rsp), %esi
movl 0x1c(%rsp), %edx
callq 0x12110
movl 0xc(%rsp), %edx
movswl (%rax), %ecx
imull %edx, %ecx
movw %cx, (%rax)
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x99c9
jmp 0x9a0d
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0x99b3
movl 0x24(%rsp), %edx
movq 0x28(%rsp), %rax
movswl 0x20(%rax), %ecx
imull %edx, %ecx
movw %cx, 0x20(%rax)
movl 0x24(%rsp), %edx
movq 0x28(%rsp), %rax
movswl 0x22(%rax), %ecx
imull %edx, %ecx
movw %cx, 0x22(%rax)
movq 0x28(%rsp), %rax
movl $0x1, 0x28(%rax)
movl 0x34(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x34(%rsp)
jmp 0x992a
movb $0x1, %al
andb $0x1, %al
addq $0x48, %rsp
retq
nopw (%rax,%rax)
// File: cloudinary[P]fuif/transform/quantize.h
// Function: fwd_quantize(Image&, std::vector<int, std::allocator<int>>&)
bool fwd_quantize(Image &input, std::vector<int> &parameters) {
    for (int c=input.nb_meta_channels; c<input.channel.size(); c++) {
        Channel &ch = input.channel[c];
        int q = (c < parameters.size() ? parameters[c] : parameters.back());
        v_printf(3,"Quantizing channel %i with quantization constant %i\n",c,q);
        for (int y=0; y<ch.h; y++) {
          for (int x=0; x<ch.w; x++) {
            ch.value(y,x) = rounded_div(ch.value(y,x),q);
          }
        }
        ch.minval /= q;
        ch.maxval /= q;
        ch.q = q;
    }
    return true;
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movq %rsi, 0x48(%rsp)
movq 0x50(%rsp), %rax
movl 0x6c(%rax), %eax
movl %eax, 0x44(%rsp)
movslq 0x44(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x50(%rsp), %rdi
callq 0x4b80
movq %rax, %rcx
movq 0x20(%rsp), %rax
cmpq %rcx, %rax
jae 0x9c0d
movq 0x50(%rsp), %rdi
movslq 0x44(%rsp), %rsi
callq 0x4ba0
movq %rax, 0x38(%rsp)
movslq 0x44(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x48(%rsp), %rdi
callq 0x4d50
movq %rax, %rcx
movq 0x18(%rsp), %rax
cmpq %rcx, %rax
jae 0x9afb
movq 0x48(%rsp), %rdi
movslq 0x44(%rsp), %rsi
callq 0x12190
movl (%rax), %eax
movl %eax, 0x14(%rsp)
jmp 0x9b0b
movq 0x48(%rsp), %rdi
callq 0x12b00
movl (%rax), %eax
movl %eax, 0x14(%rsp)
movl 0x14(%rsp), %eax
movl %eax, 0x34(%rsp)
movl 0x44(%rsp), %edx
movl 0x34(%rsp), %ecx
movl $0x3, %edi
leaq 0x3ce0e(%rip), %rsi     # 0x46935
movb $0x0, %al
callq 0x3a770
movl $0x0, 0x30(%rsp)
movl 0x30(%rsp), %eax
movq 0x38(%rsp), %rcx
cmpl 0x1c(%rcx), %eax
jge 0x9bb3
movl $0x0, 0x2c(%rsp)
movl 0x2c(%rsp), %eax
movq 0x38(%rsp), %rcx
cmpl 0x18(%rcx), %eax
jge 0x9ba4
movq 0x38(%rsp), %rdi
movl 0x30(%rsp), %esi
movl 0x2c(%rsp), %edx
callq 0x12110
movswl (%rax), %edi
movl 0x34(%rsp), %esi
callq 0x12b40
movw %ax, 0x12(%rsp)
movq 0x38(%rsp), %rdi
movl 0x30(%rsp), %esi
movl 0x2c(%rsp), %edx
callq 0x12110
movw 0x12(%rsp), %cx
movw %cx, (%rax)
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x9b4c
jmp 0x9ba6
movl 0x30(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x30(%rsp)
jmp 0x9b36
movl 0x34(%rsp), %ecx
movq 0x38(%rsp), %rax
movq %rax, (%rsp)
movswl 0x20(%rax), %eax
cltd
idivl %ecx
movl %eax, %ecx
movq (%rsp), %rax
movw %cx, 0x20(%rax)
movl 0x34(%rsp), %ecx
movq 0x38(%rsp), %rax
movq %rax, 0x8(%rsp)
movswl 0x22(%rax), %eax
cltd
idivl %ecx
movl %eax, %ecx
movq 0x8(%rsp), %rax
movw %cx, 0x22(%rax)
movl 0x34(%rsp), %ecx
movq 0x38(%rsp), %rax
movl %ecx, 0x28(%rax)
movl 0x44(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x44(%rsp)
jmp 0x9a8a
movb $0x1, %al
andb $0x1, %al
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)
// File: cloudinary[P]fuif/transform/2dmatch.h
// Function: make_offsets_table(std::vector<std::pair<int, int>, std::allocator<std::pair<int, int>>>&)
void make_offsets_table(offsets &t) {
    for (int i=1; i<t.size(); i++) {
        int xoffset, yoffset;
        compute_offset(i,xoffset,yoffset);
        t[i].first = xoffset;
        t[i].second = yoffset;
    }
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movl $0x1, 0x1c(%rsp)
movslq 0x1c(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x20(%rsp), %rdi
callq 0x13400
movq %rax, %rcx
movq 0x8(%rsp), %rax
cmpq %rcx, %rax
jae 0xe25b
movl 0x1c(%rsp), %edi
leaq 0x18(%rsp), %rsi
leaq 0x14(%rsp), %rdx
callq 0xe040
movl 0x18(%rsp), %eax
movl %eax, (%rsp)
movq 0x20(%rsp), %rdi
movslq 0x1c(%rsp), %rsi
callq 0x13420
movl (%rsp), %ecx
movl %ecx, (%rax)
movl 0x14(%rsp), %eax
movl %eax, 0x4(%rsp)
movq 0x20(%rsp), %rdi
movslq 0x1c(%rsp), %rsi
callq 0x13420
movl 0x4(%rsp), %ecx
movl %ecx, 0x4(%rax)
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0xe1e1
addq $0x28, %rsp
retq
// File: cloudinary[P]fuif/transform/2dmatch.h
// Function: default_match_parameters(std::vector<int, std::allocator<int>>&, Image const&)
void default_match_parameters(std::vector<int> &parameters, const Image &image) {
    parameters.clear();
    parameters.push_back(0); // first channel
    parameters.push_back(image.nb_channels - 1); // last channel
    parameters.push_back(0);  // 0 = only exact matches, 1 = soft match (difference gets encoded)
    parameters.push_back(1000000); // max distance (positive = search all, negative = look at corresponding positions in previous frames only)
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movq 0x20(%rsp), %rdi
callq 0x121e0
movq 0x20(%rsp), %rdi
movl $0x0, 0x14(%rsp)
leaq 0x14(%rsp), %rsi
callq 0x121b0
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rax
movl 0x64(%rax), %eax
subl $0x1, %eax
movl %eax, 0x10(%rsp)
leaq 0x10(%rsp), %rsi
callq 0x121b0
movq 0x20(%rsp), %rdi
movl $0x0, 0xc(%rsp)
leaq 0xc(%rsp), %rsi
callq 0x121b0
movq 0x20(%rsp), %rdi
movl $0xf4240, 0x8(%rsp)     # imm = 0xF4240
leaq 0x8(%rsp), %rsi
callq 0x121b0
addq $0x28, %rsp
retq