// File: /workspace/github_cpp_makefile_star2_O3/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 0x1a0f(%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 0x32ea
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 0x32ea
movups 0x19ac(%rip), %xmm0     # 0x451f
leaq 0x90(%rsp), %rsi
movaps %xmm0, 0x10(%rsi)
movups 0x1989(%rip), %xmm0     # 0x450f
movaps %xmm0, (%rsi)
movabsq $0x7200650074006e, %rax # imm = 0x7200650074006E
movq %rax, 0x20(%rsi)
leaq 0x48(%rsp), %rdi
leaq 0x158(%rsp), %rcx
movl $0x28, %edx
callq 0x32ea
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rax
movq %rax, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x90(%rsp)
movq $0x0, 0xa0(%rsp)
subq %rsi, %rbx
je 0x2c00
js 0x313b
movq %rbx, %rdi
callq 0x1150
movq %rax, %r14
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rax
movq %rax, %r15
subq %rsi, %r15
jmp 0x2c06
xorl %r14d, %r14d
movq %rbx, %r15
movq %r14, 0x90(%rsp)
movq %r14, 0x98(%rsp)
addq %r14, %rbx
movq %rbx, 0xa0(%rsp)
cmpq %rsi, %rax
je 0x2c31
movq %r14, %rdi
movq %r15, %rdx
callq 0x1200
addq %r15, %r14
movq %r14, 0x98(%rsp)
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rax
movq %rax, %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0xa8(%rsp)
movq $0x0, 0xb8(%rsp)
subq %rsi, %rbx
je 0x2c90
leaq 0xa8(%rsp), %r14
js 0x3140
movq %rbx, %rdi
callq 0x1150
movq %rax, %r15
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rax
movq %rax, %r14
subq %rsi, %r14
jmp 0x2c96
xorl %r15d, %r15d
movq %rbx, %r14
movq %r15, 0xa8(%rsp)
movq %r15, 0xb0(%rsp)
addq %r15, %rbx
movq %rbx, 0xb8(%rsp)
cmpq %rsi, %rax
je 0x2cc1
movq %r15, %rdi
movq %r14, %rdx
callq 0x1200
addq %r14, %r15
movq %r15, 0xb0(%rsp)
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rax
movq %rax, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0xc0(%rsp)
movq $0x0, 0xd0(%rsp)
subq %rsi, %rbx
je 0x2d20
leaq 0xc0(%rsp), %r14
js 0x3145
movq %rbx, %rdi
callq 0x1150
movq %rax, %r15
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rax
movq %rax, %r14
subq %rsi, %r14
jmp 0x2d26
xorl %r15d, %r15d
movq %rbx, %r14
movq %r15, 0xc0(%rsp)
movq %r15, 0xc8(%rsp)
addq %r15, %rbx
movq %rbx, 0xd0(%rsp)
cmpq %rsi, %rax
je 0x2d51
movq %r15, %rdi
movq %r14, %rdx
callq 0x1200
addq %r14, %r15
leaq 0x90(%rsp), %rsi
movq %r15, 0x38(%rsi)
leaq 0x158(%rsp), %rdi
leaq 0x30(%rsp), %rcx
movl $0x3, %edx
callq 0x332e
movl $0x48, %ebx
movq 0x78(%rsp,%rbx), %rdi
testq %rdi, %rdi
je 0x2d96
movq 0x88(%rsp,%rbx), %rsi
subq %rdi, %rsi
callq 0x1160
addq $-0x18, %rbx
jne 0x2d7c
movups 0x179e(%rip), %xmm0     # 0x4541
leaq 0x90(%rsp), %rsi
movups %xmm0, 0xa(%rsi)
movups 0x1781(%rip), %xmm0     # 0x4537
movaps %xmm0, (%rsi)
leaq 0x30(%rsp), %rdi
leaq 0x128(%rsp), %rcx
movl $0x1a, %edx
callq 0x32ea
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 0x3378
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 0x33c0
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rax
movq %rax, %r14
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
subq %rsi, %r14
je 0x2e8c
js 0x314a
movq %r14, %rdi
callq 0x1150
movq %rax, %r15
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rax
movq %rax, %r12
subq %rsi, %r12
jmp 0x2e92
xorl %r15d, %r15d
movq %r14, %r12
movq %r15, 0x10(%rsp)
movq %r15, 0x18(%rsp)
addq %r15, %r14
movq %r14, 0x20(%rsp)
cmpq %rsi, %rax
je 0x2eb4
movq %r15, %rdi
movq %r12, %rdx
callq 0x1200
addq %r12, %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 0x1df8
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2f08
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 0x244a
movq 0xd0(%rsp), %rsi
subq 0xc8(%rsp), %rsi
leaq 0x1c8(%rsp), %rdi
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
callq 0x271a
movq 0xc8(%rsp), %rsi
movq 0xd0(%rsp), %r12
movq 0x1c8(%rsp), %r15
subq %rsi, %r12
je 0x2f88
movq %r15, %rdi
movq %r12, %rdx
callq 0x1200
addq %r12, %r15
leaq 0x1e0(%rsp), %rdi
movq %r15, -0x10(%rdi)
leaq 0xe0(%rsp), %rsi
callq 0x1d46
leaq 0x1f8(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0x2530
leaq 0x190(%rsp), %rdi
callq 0x2899
movq 0x1f8(%rsp), %rdi
testq %rdi, %rdi
je 0x2fe3
movq 0x208(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
movq 0x1e0(%rsp), %rdi
testq %rdi, %rdi
je 0x3000
movq 0x1f0(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
movq 0x1c8(%rsp), %rdi
testq %rdi, %rdi
je 0x301d
movq 0x1d8(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
movq %r14, %rdi
callq 0x25c4
movq 0xf8(%rsp), %rdi
testq %rdi, %rdi
je 0x3042
movq 0x108(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0x305f
movq 0xf0(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
movq 0xc8(%rsp), %rdi
testq %rdi, %rdi
je 0x307c
movq 0xd8(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
movq %rbx, %rdi
callq 0x25c4
movq 0x140(%rsp), %rdi
testq %rdi, %rdi
je 0x30a1
movq 0x150(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
movq 0x128(%rsp), %rdi
testq %rdi, %rdi
je 0x30be
movq 0x138(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x30d5
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
leaq 0x158(%rsp), %rdi
callq 0x25c4
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x30f9
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x3110
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x312a
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
callq 0x10c0
callq 0x10c0
callq 0x10c0
callq 0x10c0
movq %rax, %rbx
leaq 0x190(%rsp), %rdi
callq 0x3412
jmp 0x31b5
movq %rax, %rbx
movq 0x1e0(%rsp), %rdi
testq %rdi, %rdi
je 0x3186
movq 0x1f0(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
jmp 0x3186
movq %rax, %rbx
movq 0x1c8(%rsp), %rdi
testq %rdi, %rdi
je 0x31a8
movq 0x1d8(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
jmp 0x31a8
movq %rax, %rbx
movq %r14, %rdi
callq 0x25c4
jmp 0x31b5
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x3412
jmp 0x3222
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x3222
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
jmp 0x3222
movq %rax, %rbx
jmp 0x323f
movq %rax, %rbx
jmp 0x325c
movq %rax, %rbx
jmp 0x3273
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x12f8
jmp 0x329a
movq %rax, %rbx
jmp 0x32b1
movq %rax, %rbx
jmp 0x32c8
movq %rax, %rbx
movq 0x140(%rsp), %rdi
testq %rdi, %rdi
je 0x323f
movq 0x150(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
movq 0x128(%rsp), %rdi
testq %rdi, %rdi
je 0x325c
movq 0x138(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x3273
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
leaq 0x158(%rsp), %rdi
callq 0x25c4
jmp 0x329a
movq %rax, %rbx
jmp 0x329a
movq %rax, %rbx
leaq 0x90(%rsp), %rsi
movq %r14, %rdi
callq 0x12c8
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x32b1
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x32c8
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x32e2
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0x1160
movq %rbx, %rdi
callq 0x1220