// File: /workspace/github_cpp_makefile_star2_O1/DavieV[P]virtual-usb-printer/main.cc
// Function: main
int main() {
  const USB_DEVICE_DESCRIPTOR device = {
      0x12,                   // Size of this descriptor in bytes
      USB_DESCRIPTOR_DEVICE,  // descriptor type
      0x0110,                 // USB Spec Release Number in BCD format
      0x00,                   // Class Code
      0x00,                   // Subclass code
      0x00,                   // Protocol code
      0x08,                   // Max packet size for EP0, see usb_config.h
      0x04a9,                 // Vendor ID
      0x27e8,                 // Product ID
      0x0000,                 // Device release number in BCD format
      0x01,                   // Manufacturer string descriptor index
      0x02,                   // Product string descriptor index
      0x01,                   // Device serial number string descriptor index
      0x01,                   // Number of possible configurations
  };

  const USB_CONFIGURATION_DESCRIPTOR configuration = {
      0x09,                          // Size of this descriptor in bytes.
      USB_DESCRIPTOR_CONFIGURATION,  // descriptor type.
      0x20,  // Total length of data for this configuration.
      0x01,  // Number of interfaces in this configuration.
      0x01,  // Index value for this configuration.
      0x00,  // Configuration string descriptor index.
      0x80,  // Configuration characteristics (bmAttributes).
      0x00,  // Max power consumption (2X mA).
  };

  std::vector<char> str1 = {
      0x04, USB_DESCRIPTOR_STRING, // bLength, bDscType
      0x09, 0x04
  };

  std::vector<char> str2 = {
      0x0E, USB_DESCRIPTOR_STRING, // bLength, bDscType
      'D', 0x00,
      'a', 0x00,
      'v', 0x00,
      'i', 0x00,
      'e', 0x00,
      'V', 0x00,
  };

  std::vector<char> str3 = {
      0x28, USB_DESCRIPTOR_STRING, // bLength, bDscType
      'V', 0x00,
      'i', 0x00,
      'r', 0x00,
      't', 0x00,
      'u', 0x00,
      'a', 0x00,
      'l', 0x00,
      ' ', 0x00,
      'U', 0x00,
      'S', 0x00,
      'B', 0x00,
      ' ', 0x00,
      'P', 0x00,
      'r', 0x00,
      'i', 0x00,
      'n', 0x00,
      't', 0x00,
      'e', 0x00,
      'r', 0x00,
  };

  const std::vector<std::vector<char>> strings = {str1, str2, str3};

  const std::vector<char> ieee_device_id = {
    0x00, 0x1A,  // Length (26 bytes)
    'M', 'F', 'G', ':', 'D', 'V', '3', ';',
    'C', 'M', 'D', ':', 'P', 'D', 'F', ';',
    'M', 'D', 'L', ':', 'V', 'T', 'L', ';',
  };

  const std::vector<USB_INTERFACE_DESCRIPTOR> interfaces = {
      {
          0x09,                      // Size of this descriptor in bytes
          USB_DESCRIPTOR_INTERFACE,  // descriptor type.
          0x00,                      // Interface Number.
          0x00,                      // Alternate Setting Number.
          0x02,                      // Number of endpoints in this interface.
          0x07,                      // Class code.
          0x01,                      // Subclass code.
          0x02,                      // Protocol code.
          0x00,                      // Interface string index.
      },
      /*
      {
          0x09,                      // Size of this descriptor in bytes
          USB_DESCRIPTOR_INTERFACE,  // descriptor type.
          0x01,                      // Interface Number.
          0x00,                      // Alternate Setting Number.
          0x02,                      // Number of endpoints in this interface.
          0x07,                      // Class code.
          0x01,                      // Subclass code.
          0x02,                      // Protocol code.
          0x00,                      // Interface string index.
      }*/};

  const std::vector<USB_ENDPOINT_DESCRIPTOR> endpoints = {
      {
          0x07,                     // Size of this descriptor in bytes.
          USB_DESCRIPTOR_ENDPOINT,  // descriptor type.
          0x01,                     // Endpoint Address.
          0x02,                     // Attributes (Bulk Endpoint).
          512,                      // Max transfer size.
          0x00,                     // Interval.
      },
      {
          0x07,                     // Size of this descriptor in bytes.
          USB_DESCRIPTOR_ENDPOINT,  // descriptor type.
          0x81,                     // Endpoint Address.
          0x02,                     // Attributes (Bulk Endpoint).
          512,                      // Max transfer size.
          0x00,                     // Interval.
      },
      /*
      {
          0x07,                     // Size of this descriptor in bytes.
          USB_DESCRIPTOR_ENDPOINT,  // descriptor type.
          0x03,                     // Endpoint Address.
          0x02,                     // Attributes (Bulk Endpoint).
          0x08,                     // Max transfer size.
          0x00,                     // Interval.
      },
      {
          0x07,                     // Size of this descriptor in bytes.
          USB_DESCRIPTOR_ENDPOINT,  // descriptor type.
          0x84,                     // Endpoint Address.
          0x02,                     // Attributes (Bulk Endpoint).
          0x08,                     // Max transfer size.
          0x00,                     // Interval.
      }*/};

  UsbPrinter printer(device, configuration, strings, ieee_device_id, interfaces,
                     endpoints);
  run_server(printer);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movups 0x19cb(%rip), %xmm0     # 0x44f4
movaps %xmm0, 0x170(%rsp)
movw $0x101, 0x180(%rsp)     # imm = 0x101
movabsq $-0x7ffffefeffdffdf7, %rax # imm = 0x8000010100200209
movq %rax, 0x118(%rsp)
movb $0x0, 0x120(%rsp)
leaq 0x90(%rsp), %rbx
movl $0x4090304, (%rbx)      # imm = 0x4090304
leaq 0x78(%rsp), %rdi
leaq 0x60(%rsp), %rcx
movl $0x4, %edx
movq %rbx, %rsi
callq 0x32fe
movabsq $0x7600610044030e, %rax # imm = 0x7600610044030E
movq %rax, (%rbx)
movl $0x650069, 0x8(%rbx)    # imm = 0x650069
movw $0x56, 0xc(%rbx)
leaq 0x60(%rsp), %rdi
leaq 0x90(%rsp), %rsi
leaq 0x48(%rsp), %rcx
movl $0xe, %edx
callq 0x32fe
movups 0x1968(%rip), %xmm0     # 0x451f
leaq 0x90(%rsp), %r14
movaps %xmm0, 0x10(%r14)
movups 0x1944(%rip), %xmm0     # 0x450f
movaps %xmm0, (%r14)
movabsq $0x7200650074006e, %rax # imm = 0x7200650074006E
movq %rax, 0x20(%r14)
leaq 0x48(%rsp), %rdi
leaq 0x158(%rsp), %rcx
movl $0x28, %edx
movq %r14, %rsi
callq 0x32fe
movq 0x80(%rsp), %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x90(%rsp)
movq $0x0, 0xa0(%rsp)
subq 0x78(%rsp), %rbx
je 0x2c33
js 0x314b
movq %r14, %r15
movq %rbx, %rdi
callq 0x1150
movq %rax, %r12
jmp 0x2c36
xorl %r12d, %r12d
movq %r12, 0x90(%rsp)
movq %r12, 0x98(%rsp)
addq %r12, %rbx
movq %rbx, 0xa0(%rsp)
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rbx
subq %rsi, %rbx
je 0x2c6e
movq %r12, %rdi
movq %rbx, %rdx
callq 0x1200
addq %rbx, %r12
movq %r12, 0x98(%rsp)
movq 0x68(%rsp), %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0xa8(%rsp)
movq $0x0, 0xb8(%rsp)
subq 0x60(%rsp), %rbx
je 0x2cb7
leaq 0xa8(%rsp), %r15
js 0x3153
movq %rbx, %rdi
callq 0x1150
movq %rax, %r12
jmp 0x2cba
xorl %r12d, %r12d
movq %r12, 0xa8(%rsp)
movq %r12, 0xb0(%rsp)
addq %r12, %rbx
movq %rbx, 0xb8(%rsp)
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rbx
subq %rsi, %rbx
je 0x2cef
movq %r12, %rdi
movq %rbx, %rdx
callq 0x1200
addq %rbx, %r12
movq %r12, 0xb0(%rsp)
movq 0x50(%rsp), %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0xc0(%rsp)
movq $0x0, 0xd0(%rsp)
subq 0x48(%rsp), %rbx
je 0x2d38
leaq 0xc0(%rsp), %r15
js 0x3158
movq %rbx, %rdi
callq 0x1150
movq %rax, %r12
jmp 0x2d3b
xorl %r12d, %r12d
movq %r12, 0xc0(%rsp)
movq %r12, 0xc8(%rsp)
addq %r12, %rbx
movq %rbx, 0xd0(%rsp)
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rbx
subq %rsi, %rbx
je 0x2d70
movq %r12, %rdi
movq %rbx, %rdx
callq 0x1200
addq %rbx, %r12
leaq 0x90(%rsp), %rsi
movq %r12, 0x38(%rsi)
leaq 0x158(%rsp), %rdi
leaq 0x30(%rsp), %rcx
movl $0x3, %edx
callq 0x3342
movl $0x48, %ebx
movq 0x78(%rsp,%rbx), %rdi
testq %rdi, %rdi
je 0x2db5
movq 0x88(%rsp,%rbx), %rsi
subq %rdi, %rsi
callq 0x1160
addq $-0x18, %rbx
jne 0x2d9b
movups 0x177f(%rip), %xmm0     # 0x4541
leaq 0x90(%rsp), %rsi
movups %xmm0, 0xa(%rsi)
movups 0x1762(%rip), %xmm0     # 0x4537
movaps %xmm0, (%rsi)
leaq 0x30(%rsp), %rdi
leaq 0x128(%rsp), %rcx
movl $0x1a, %edx
callq 0x32fe
movabsq $0x201070200000409, %rax # imm = 0x201070200000409
leaq 0x90(%rsp), %rsi
movq %rax, (%rsi)
movb $0x0, 0x8(%rsi)
leaq 0x128(%rsp), %rdi
leaq 0x140(%rsp), %rcx
movl $0x1, %edx
callq 0x338c
leaq 0x90(%rsp), %rsi
movl $0x2010507, (%rsi)      # imm = 0x2010507
movw $0x200, %ax             # imm = 0x200
movw %ax, 0x4(%rsi)
movl $0x81050700, 0x6(%rsi)  # imm = 0x81050700
movb $0x2, 0xa(%rsi)
movw %ax, 0xb(%rsi)
movb $0x0, 0xd(%rsi)
leaq 0x140(%rsp), %rbx
leaq 0xf(%rsp), %rcx
movl $0x2, %edx
movq %rbx, %rdi
callq 0x33d4
movq 0x38(%rsp), %r14
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
subq 0x30(%rsp), %r14
je 0x2e95
js 0x315d
movq %r14, %rdi
callq 0x1150
movq %rax, %r15
jmp 0x2e98
xorl %r15d, %r15d
movq %r15, 0x10(%rsp)
movq %r15, 0x18(%rsp)
addq %r15, %r14
movq %r14, 0x20(%rsp)
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %r14
subq %rsi, %r14
je 0x2ec4
movq %r15, %rdi
movq %r14, %rdx
callq 0x1200
addq %r14, %r15
leaq 0x10(%rsp), %r8
movq %r15, 0x8(%r8)
movq %rbx, (%rsp)
leaq 0x90(%rsp), %rdi
leaq 0x170(%rsp), %rsi
leaq 0x118(%rsp), %rdx
leaq 0x158(%rsp), %rcx
leaq 0x128(%rsp), %r9
callq 0x1dfc
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2f18
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
leaq 0xb0(%rsp), %rbx
movups -0x20(%rbx), %xmm0
movups -0x15(%rbx), %xmm1
leaq 0x1b0(%rsp), %r14
movups %xmm1, -0x15(%r14)
movaps %xmm0, -0x20(%r14)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2452
movq 0xd0(%rsp), %rsi
subq 0xc8(%rsp), %rsi
leaq 0x1c8(%rsp), %rdi
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
callq 0x271c
movq 0xc8(%rsp), %rsi
movq 0xd0(%rsp), %r12
movq 0x1c8(%rsp), %r15
subq %rsi, %r12
je 0x2f98
movq %r15, %rdi
movq %r12, %rdx
callq 0x1200
addq %r12, %r15
leaq 0x1e0(%rsp), %rdi
movq %r15, -0x10(%rdi)
leaq 0xe0(%rsp), %rsi
callq 0x1d4a
leaq 0x1f8(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0x2538
leaq 0x190(%rsp), %rdi
callq 0x2894
movq 0x1f8(%rsp), %rdi
testq %rdi, %rdi
je 0x2ff3
movq 0x208(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
movq 0x1e0(%rsp), %rdi
testq %rdi, %rdi
je 0x3010
movq 0x1f0(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
movq 0x1c8(%rsp), %rdi
testq %rdi, %rdi
je 0x302d
movq 0x1d8(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
movq %r14, %rdi
callq 0x25cc
movq 0xf8(%rsp), %rdi
testq %rdi, %rdi
je 0x3052
movq 0x108(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0x306f
movq 0xf0(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
movq 0xc8(%rsp), %rdi
testq %rdi, %rdi
je 0x308c
movq 0xd8(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
movq %rbx, %rdi
callq 0x25cc
movq 0x140(%rsp), %rdi
testq %rdi, %rdi
je 0x30b1
movq 0x150(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
movq 0x128(%rsp), %rdi
testq %rdi, %rdi
je 0x30ce
movq 0x138(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x30e5
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
leaq 0x158(%rsp), %rdi
callq 0x25cc
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x3109
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x3120
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x313a
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
xorl %eax, %eax
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %r14, %r15
callq 0x10c0
callq 0x10c0
callq 0x10c0
callq 0x10c0
movq %rax, %rbx
leaq 0x190(%rsp), %rdi
callq 0x3426
jmp 0x31c8
movq %rax, %rbx
movq 0x1e0(%rsp), %rdi
testq %rdi, %rdi
je 0x3199
movq 0x1f0(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
jmp 0x3199
movq %rax, %rbx
movq 0x1c8(%rsp), %rdi
testq %rdi, %rdi
je 0x31bb
movq 0x1d8(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
jmp 0x31bb
movq %rax, %rbx
movq %r14, %rdi
callq 0x25cc
jmp 0x31c8
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x3426
jmp 0x3235
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x3235
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
jmp 0x3235
movq %rax, %rbx
jmp 0x3252
movq %rax, %rbx
jmp 0x326f
movq %rax, %rbx
jmp 0x3286
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x12f8
jmp 0x32ad
movq %rax, %rbx
jmp 0x32c4
movq %rax, %rbx
jmp 0x32db
movq %rax, %rbx
movq 0x140(%rsp), %rdi
testq %rdi, %rdi
je 0x3252
movq 0x150(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
movq 0x128(%rsp), %rdi
testq %rdi, %rdi
je 0x326f
movq 0x138(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x3286
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
leaq 0x158(%rsp), %rdi
callq 0x25cc
jmp 0x32ad
movq %rax, %rbx
cmpq %r15, %r14
je 0x32ad
leaq 0x90(%rsp), %rsi
movq %r15, %rdi
callq 0x12c8
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x32c4
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x32db
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x32f5
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
movq %rbx, %rdi
callq 0x1220
nop