// File: jgeumlek[P]moltengamepadctl/source/main.cpp
// Function: osc_msg(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, ...)
int osc_msg(int fd, const std::string& path, int id, const std::string& argtypes, ...) {
  oscpkt::PacketWriter pw;
  oscpkt::Message msg;
  msg.init(path);
  msg.pushInt32(id);
  if (!argtypes.empty()) {
    va_list arglist;
    va_start(arglist, argtypes);
    int n = argtypes.size();
    for (int i = 0; i < n; i++) {
      if (argtypes[i] == 'i') {
        int arg = va_arg(arglist, int);
        msg.pushInt32(arg);
      }
      if (argtypes[i] == 'b') {
        int arg = va_arg(arglist, int);
        msg.pushBool(arg != 0);
      }
      if (argtypes[i] == 's') {
        const char* arg = va_arg(arglist, const char*);
        if (!arg) {
          msg.pushStr("");
        } else {
          std::string str(arg);
          msg.pushStr(str);
        }
      }
    }
  }
  add_pending(id);
  pw.init().addMessage(msg);
  uint32_t size = pw.packetSize();
  write(fd, &size, sizeof(size));
  write(fd, pw.packetData(), size);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2c0, %rsp            # imm = 0x2C0
testb %al, %al
je 0x37e7
movaps %xmm0, -0x200(%rbp)
movaps %xmm1, -0x1f0(%rbp)
movaps %xmm2, -0x1e0(%rbp)
movaps %xmm3, -0x1d0(%rbp)
movaps %xmm4, -0x1c0(%rbp)
movaps %xmm5, -0x1b0(%rbp)
movaps %xmm6, -0x1a0(%rbp)
movaps %xmm7, -0x190(%rbp)
movq %r9, -0x208(%rbp)
movq %r8, -0x210(%rbp)
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x56c0
leaq -0xd8(%rbp), %rdi
callq 0x5740
jmp 0x381a
movq -0x10(%rbp), %rax
movq %rax, -0x240(%rbp)
callq 0x5890
movq %rax, -0x238(%rbp)
jmp 0x3833
movq -0x240(%rbp), %rsi
movq -0x238(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0xf0(%rbp), %rdx
leaq -0xd8(%rbp), %rdi
callq 0x5800
jmp 0x385d
movl -0x14(%rbp), %esi
leaq -0xd8(%rbp), %rdi
callq 0x58b0
jmp 0x386e
movq -0x20(%rbp), %rdi
callq 0x3430
testb $0x1, %al
jne 0x3c4e
leaq -0x110(%rbp), %rax
leaq -0x230(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x30, 0x4(%rax)
movl $0x20, (%rax)
movq -0x20(%rbp), %rdi
callq 0x31f0
movl %eax, -0x114(%rbp)
movl $0x0, -0x118(%rbp)
movl -0x118(%rbp), %eax
cmpl -0x114(%rbp), %eax
jge 0x3c4c
movq -0x20(%rbp), %rdi
movslq -0x118(%rbp), %rsi
callq 0x32f0
movsbl (%rax), %eax
cmpl $0x69, %eax
jne 0x399e
leaq -0x110(%rbp), %rax
movq %rax, -0x250(%rbp)
movl -0x110(%rbp), %eax
movl %eax, -0x244(%rbp)
cmpl $0x28, %eax
ja 0x395c
movq -0x250(%rbp), %rcx
movl -0x244(%rbp), %edx
movslq %edx, %rax
addq 0x10(%rcx), %rax
addl $0x8, %edx
movl %edx, (%rcx)
movq %rax, -0x258(%rbp)
jmp 0x3979
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe0(%rbp)
movl %eax, -0xe4(%rbp)
jmp 0x3cf7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe0(%rbp)
movl %eax, -0xe4(%rbp)
jmp 0x3ceb
movq -0x250(%rbp), %rcx
movq 0x8(%rcx), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x8(%rcx)
movq %rax, -0x258(%rbp)
movq -0x258(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x11c(%rbp)
movl -0x11c(%rbp), %esi
leaq -0xd8(%rbp), %rdi
callq 0x58b0
jmp 0x399c
jmp 0x399e
movq -0x20(%rbp), %rdi
movslq -0x118(%rbp), %rsi
callq 0x32f0
movsbl (%rax), %eax
cmpl $0x62, %eax
jne 0x3a45
leaq -0x110(%rbp), %rax
movq %rax, -0x268(%rbp)
movl -0x110(%rbp), %eax
movl %eax, -0x25c(%rbp)
cmpl $0x28, %eax
ja 0x39fb
movq -0x268(%rbp), %rcx
movl -0x25c(%rbp), %edx
movslq %edx, %rax
addq 0x10(%rcx), %rax
addl $0x8, %edx
movl %edx, (%rcx)
movq %rax, -0x270(%rbp)
jmp 0x3a18
movq -0x268(%rbp), %rcx
movq 0x8(%rcx), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x8(%rcx)
movq %rax, -0x270(%rbp)
movq -0x270(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x120(%rbp)
movl -0x120(%rbp), %eax
testl %eax, %eax
setne %al
movzbl %al, %esi
leaq -0xd8(%rbp), %rdi
callq 0x58e0
jmp 0x3a43
jmp 0x3a45
movq -0x20(%rbp), %rdi
movslq -0x118(%rbp), %rsi
callq 0x32f0
movsbl (%rax), %eax
cmpl $0x73, %eax
jne 0x3c36
leaq -0x110(%rbp), %rax
movq %rax, -0x280(%rbp)
movl -0x110(%rbp), %eax
movl %eax, -0x274(%rbp)
cmpl $0x28, %eax
ja 0x3aa2
movq -0x280(%rbp), %rcx
movl -0x274(%rbp), %edx
movslq %edx, %rax
addq 0x10(%rcx), %rax
addl $0x8, %edx
movl %edx, (%rcx)
movq %rax, -0x288(%rbp)
jmp 0x3abf
movq -0x280(%rbp), %rcx
movq 0x8(%rcx), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x8(%rcx)
movq %rax, -0x288(%rbp)
movq -0x288(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x128(%rbp)
cmpq $0x0, -0x128(%rbp)
jne 0x3b82
leaq -0x149(%rbp), %rdi
movq %rdi, -0x290(%rbp)
callq 0x3480
movq -0x290(%rbp), %rdx
leaq 0xa6b5(%rip), %rsi      # 0xe1b4
leaq -0x148(%rbp), %rdi
callq 0x3370
jmp 0x3b0d
leaq -0xd8(%rbp), %rdi
leaq -0x148(%rbp), %rsi
callq 0x5980
jmp 0x3b22
leaq -0x148(%rbp), %rdi
callq 0x31b0
leaq -0x149(%rbp), %rdi
callq 0x32e0
jmp 0x3c34
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe0(%rbp)
movl %eax, -0xe4(%rbp)
jmp 0x3b71
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe0(%rbp)
movl %eax, -0xe4(%rbp)
leaq -0x148(%rbp), %rdi
callq 0x31b0
leaq -0x149(%rbp), %rdi
callq 0x32e0
jmp 0x3ceb
movq -0x128(%rbp), %rax
movq %rax, -0x2a0(%rbp)
leaq -0x171(%rbp), %rdi
movq %rdi, -0x298(%rbp)
callq 0x3480
movq -0x2a0(%rbp), %rsi
movq -0x298(%rbp), %rdx
leaq -0x170(%rbp), %rdi
callq 0x3370
jmp 0x3bbf
leaq -0x171(%rbp), %rdi
callq 0x32e0
leaq -0xd8(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0x5980
jmp 0x3be0
leaq -0x170(%rbp), %rdi
callq 0x31b0
jmp 0x3c34
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe0(%rbp)
movl %eax, -0xe4(%rbp)
leaq -0x171(%rbp), %rdi
callq 0x32e0
jmp 0x3ceb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe0(%rbp)
movl %eax, -0xe4(%rbp)
leaq -0x170(%rbp), %rdi
callq 0x31b0
jmp 0x3ceb
jmp 0x3c36
jmp 0x3c38
movl -0x118(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x118(%rbp)
jmp 0x38bf
jmp 0x3c4e
movl -0x14(%rbp), %edi
callq 0x3650
jmp 0x3c58
leaq -0x58(%rbp), %rdi
callq 0x5a80
movq %rax, -0x2a8(%rbp)
jmp 0x3c6a
movq -0x2a8(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x5ac0
jmp 0x3c7f
leaq -0x58(%rbp), %rdi
callq 0x5b80
movl %eax, -0x2ac(%rbp)
jmp 0x3c90
movl -0x2ac(%rbp), %eax
movl %eax, -0x178(%rbp)
movl -0x4(%rbp), %edi
leaq -0x178(%rbp), %rsi
movl $0x4, %edx
callq 0x30b0
jmp 0x3cb2
movl -0x4(%rbp), %eax
movl %eax, -0x2bc(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x5bc0
movq %rax, -0x2b8(%rbp)
jmp 0x3ccd
movq -0x2b8(%rbp), %rsi
movl -0x2bc(%rbp), %edi
movl -0x178(%rbp), %eax
movl %eax, %edx
callq 0x30b0
jmp 0x3ce9
ud2
leaq -0xd8(%rbp), %rdi
callq 0x5c00
leaq -0x58(%rbp), %rdi
callq 0x5c50
movq -0xe0(%rbp), %rdi
callq 0x3470
nopl (%rax)