// File: /workspace/github_cpp_makefile_star2_O2/jgeumlek[P]moltengamepadctl/source/main.cpp
// Function: handle_message(oscpkt::Message*, oscpkt::Message::ArgReader*, int)
int handle_message(oscpkt::Message* msg, oscpkt::Message::ArgReader* arg, int id) {
  if (msg->match("/text")) {
    std::string text;
    arg->popStr(text);
    std::cout << text << std::endl;
  } else if (msg->match("/error")) {
    std::string text, path;
    int line;
    arg->popStr(text);
    arg->popStr(path);
    arg->popInt32(line);
    std::cerr << text;
    if (!path.empty()) {
      std::cerr << "(" << path;
      if (line >= 0) {
        std::cerr << ":" << line;
      }
      std::cerr << ")";
    }
    std::cerr << std::endl;
  } else {
    //a generic catch-all to print something to the user.
    std::cout << msg->addressPattern() << ": ";
    while (arg->nbArgRemaining() > 0) {
      if (arg->isInt32()) {
        int i;
        arg->popInt32(i);
        std::cout << i << " ";
      } else if (arg->isStr()) {
        std::string s;
        arg->popStr(s);
        std::cout << "\"" << s << "\" ";
      }
    }
    std::cout << std::endl;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x2670(%rip), %rsi      # 0x50ce
leaq 0x8(%rsp), %rdi
leaq 0x4(%rsp), %rdx
callq 0x20c0
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rdx
movq %r15, %rsi
callq 0x3644
movl 0x30(%rsp), %ebp
leaq 0x8(%rsp), %rdi
callq 0x20f0
testl %ebp, %ebp
jne 0x2acd
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x37aa
movq 0x551a(%rip), %rdi      # 0x7fd0
leaq 0x8(%rsp), %rsi
callq 0x2200
movq %rax, %rdi
callq 0x2120
jmp 0x2b87
leaq 0x2600(%rip), %rsi      # 0x50d4
leaq 0x8(%rsp), %rdi
leaq 0x4(%rsp), %rdx
callq 0x20c0
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rdx
movq %r15, %rsi
callq 0x3644
movl 0x30(%rsp), %ebp
leaq 0x8(%rsp), %rdi
callq 0x20f0
testl %ebp, %ebp
jne 0x2b91
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
movb %cl, (%rax)
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x37aa
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
callq 0x37aa
leaq 0x4(%rsp), %rsi
movq %rbx, %rdi
callq 0x3638
movq 0x5495(%rip), %rdi      # 0x7ff0
leaq 0x8(%rsp), %rsi
callq 0x2200
cmpq $0x0, 0x30(%rsp)
jne 0x2c70
movq 0x5478(%rip), %rdi      # 0x7ff0
callq 0x2120
leaq 0x28(%rsp), %rdi
callq 0x20f0
leaq 0x8(%rsp), %rdi
callq 0x20f0
addq $0x8, %r15
movq 0x5434(%rip), %r14      # 0x7fd0
movq %r14, %rdi
movq %r15, %rsi
callq 0x2200
leaq 0x2531(%rip), %rsi      # 0x50df
movq %rax, %rdi
callq 0x2230
leaq 0x8(%rsp), %r15
leaq 0x2523(%rip), %r12      # 0x50e5
leaq 0x2519(%rip), %r13      # 0x50e2
leaq 0x2514(%rip), %rbp      # 0x50e4
movq (%rbx), %rax
movq 0x50(%rax), %rcx
subq 0x48(%rax), %rcx
sarq $0x4, %rcx
cmpq 0x10(%rbx), %rcx
je 0x2cce
movq %rbx, %rdi
callq 0x362a
movq %rbx, %rdi
testb %al, %al
je 0x2c19
movq %r15, %rsi
callq 0x3638
movl 0x8(%rsp), %esi
movq %r14, %rdi
callq 0x2320
movq %rax, %rdi
movq %r12, %rsi
callq 0x2230
jmp 0x2bd0
callq 0x37ea
testb %al, %al
je 0x2bd0
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
andq $0x0, 0x10(%rsp)
movb $0x0, 0x18(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x37aa
movq %r14, %rdi
movq %r13, %rsi
callq 0x2230
movq %rax, %rdi
movq %r15, %rsi
callq 0x2200
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2230
movq %r15, %rdi
callq 0x20f0
jmp 0x2bd0
movq 0x5379(%rip), %rdi      # 0x7ff0
leaq 0x245d(%rip), %rsi      # 0x50db
callq 0x2230
leaq 0x28(%rsp), %rsi
movq %rax, %rdi
callq 0x2200
cmpl $0x0, 0x4(%rsp)
js 0x2cb6
movq 0x5352(%rip), %rdi      # 0x7ff0
leaq 0x2438(%rip), %rsi      # 0x50dd
callq 0x2230
movl 0x4(%rsp), %esi
movq %rax, %rdi
callq 0x2320
movq 0x5333(%rip), %rdi      # 0x7ff0
leaq 0x2678(%rip), %rsi      # 0x533c
callq 0x2230
jmp 0x2b71
movq 0x52fb(%rip), %rdi      # 0x7fd0
callq 0x2120
jmp 0x2cf1
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x20f0
jmp 0x2cf4
jmp 0x2cf1
jmp 0x2d00
jmp 0x2cf1
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x20f0
jmp 0x2d03
movq %rax, %rbx
movq %rbx, %rdi
callq 0x2340