// File: /workspace/github_cpp_makefile_star2_O1/hoehermann[P]TypedJNI/test.cpp
// Function: main
int main(int argc, char **argv)
{
    JavaVMInitArgs  vm_args;
    JavaVMOption jvmo;
    std::vector<JavaVMOption> options;
    //jvmo.optionString = const_cast<char*>("-verbose:gc"); options.push_back(jvmo);
    //jvmo.optionString = const_cast<char*>("-XX:+PrintGCTimeStamps"); options.push_back(jvmo);
    //jvmo.optionString = const_cast<char*>("-XX:+PrintGCDetails"); options.push_back(jvmo);
    vm_args.options = options.data();
    vm_args.nOptions = options.size();
    vm_args.version  = JNI_VERSION_1_8;
    TypedJNIEnv tenv(vm_args);
    TypedJNIClass javacls = tenv.find_class("TypedJNITest");
    javacls.GetStaticMethod<void()>("printHelloWorld");
    javacls.GetStaticMethod<void(jlong)>("printLong")(1);
    javacls.GetStaticMethod<void(jlong,jlong)>("print2Long")(1,2);
    {
        const long l = 1;
        std::cout << l << " incremented by Java is " << javacls.GetStaticMethod<jint(jint)>("increment")(l) << std::endl;
    }
    
    TypedJNIObject javaobj = javacls.GetConstructor<jstring>()(tenv.make_jstring("5"));
    {
        jint i = javaobj.GetMethod<jint(jint)>("incrementCounterBy")(2);
        std::cout << "After incrementing, counter is " << i << "." << std::endl;
    }
    javaobj.GetMethod<void(void)>("printCounter")();
    
    TypedJNIString s = tenv.make_jstring(std::string("Some words"));
    javaobj.GetMethod<void(jstring, jint)>("printInBackground")(s, 10);
    std::this_thread::sleep_for(std::chrono::seconds(5));

    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x1f8, %rsp            # imm = 0x1F8
movq $0x10008, 0x1c0(%rsp) # imm = 0x10008
movq $0x0, 0x1c8(%rsp)
movq 0x1d0(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x1c0(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0xa8(%rsp), %rdi
callq 0x7368
leaq 0x1b0(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x5c3d(%rip), %rsi      # 0x9084
leaq 0x5c42(%rip), %rdx      # 0x9090
leaq 0x1a0(%rsp), %rdi
callq 0x3fe8
leaq 0xa8(%rsp), %rdi
leaq 0x1a0(%rsp), %rsi
callq 0x7596
movq %rax, 0x58(%rsp)
movq %rdx, 0x60(%rsp)
movq 0x1a0(%rsp), %rdi
cmpq %r14, %rdi
je 0x3497
movq 0x1b0(%rsp), %rsi
incq %rsi
callq 0x31b0
leaq 0x190(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x5be7(%rip), %rsi      # 0x9091
leaq 0x5bef(%rip), %rdx      # 0x90a0
leaq 0x180(%rsp), %rdi
callq 0x3fe8
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
leaq 0x1d8(%rsp), %rdi
leaq 0x180(%rsp), %rcx
callq 0x4078
movq 0x1e8(%rsp), %rax
testq %rax, %rax
je 0x34fc
leaq 0x1d8(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x180(%rsp), %rdi
cmpq %r14, %rdi
je 0x3519
movq 0x190(%rsp), %rsi
incq %rsi
callq 0x31b0
leaq 0x170(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x5b75(%rip), %rsi      # 0x90a1
leaq 0x5b77(%rip), %rdx      # 0x90aa
leaq 0x160(%rsp), %rdi
callq 0x3fe8
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
leaq 0x38(%rsp), %rdi
leaq 0x160(%rsp), %rcx
callq 0x45d6
movq $0x1, 0x18(%rsp)
cmpq $0x0, 0x48(%rsp)
je 0x3b10
leaq 0x38(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq *0x18(%rdi)
movq 0x48(%rsp), %rax
testq %rax, %rax
je 0x3597
leaq 0x38(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x160(%rsp), %rdi
cmpq %r14, %rdi
je 0x35b4
movq 0x170(%rsp), %rsi
incq %rsi
callq 0x31b0
leaq 0x150(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x5ae4(%rip), %rsi      # 0x90ab
leaq 0x5ae7(%rip), %rdx      # 0x90b5
leaq 0x140(%rsp), %rdi
callq 0x3fe8
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
leaq 0x38(%rsp), %rdi
leaq 0x140(%rsp), %rcx
callq 0x4a14
movq $0x1, 0x18(%rsp)
movq $0x2, 0x70(%rsp)
cmpq $0x0, 0x48(%rsp)
je 0x3b15
leaq 0x38(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x70(%rsp), %rdx
callq *0x18(%rdi)
movq 0x48(%rsp), %rax
testq %rax, %rax
je 0x3640
leaq 0x38(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x140(%rsp), %rdi
cmpq %r14, %rdi
je 0x365d
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x31b0
movq 0x9974(%rip), %rdi      # 0xcfd8
movl $0x1, %esi
callq 0x3180
movq %rax, %rbx
leaq 0x5a3e(%rip), %rsi      # 0x90b6
movl $0x18, %edx
movq %rax, %rdi
callq 0x31d0
leaq 0x130(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x5a37(%rip), %rsi      # 0x90cf
leaq 0x5a39(%rip), %rdx      # 0x90d8
leaq 0x120(%rsp), %rdi
callq 0x3fe8
leaq 0x38(%rsp), %rdi
leaq 0x58(%rsp), %rsi
leaq 0x120(%rsp), %rdx
callq 0x3e44
movl $0x1, 0x18(%rsp)
cmpq $0x0, 0x48(%rsp)
je 0x3b1a
leaq 0x38(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq *0x18(%rdi)
movq %rbx, %rdi
movl %eax, %esi
callq 0x3270
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3190
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3100
movq 0x48(%rsp), %rax
testq %rax, %rax
je 0x3731
leaq 0x38(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x120(%rsp), %rdi
cmpq %r14, %rdi
je 0x374e
movq 0x130(%rsp), %rsi
incq %rsi
callq 0x31b0
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
leaq 0x18(%rsp), %rdi
callq 0x545c
leaq 0x80(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x5964(%rip), %rsi      # 0x90d9
leaq 0x595e(%rip), %rdx      # 0x90da
leaq 0x70(%rsp), %rdi
callq 0x3fe8
leaq 0x90(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
leaq 0x70(%rsp), %rdx
callq 0x76ce
leaq 0x90(%rsp), %rdi
callq 0x72a4
movq %rax, 0x68(%rsp)
cmpq $0x0, 0x28(%rsp)
je 0x3b1f
leaq 0x38(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x68(%rsp), %rdx
callq *0x18(%rsi)
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x37e2
callq 0x3f78
movq 0x70(%rsp), %rdi
cmpq %r14, %rdi
je 0x37fc
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x31b0
movq 0x28(%rsp), %rax
testq %rax, %rax
je 0x3815
leaq 0x18(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq 0x110(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x58b3(%rip), %rsi      # 0x90db
leaq 0x58be(%rip), %rdx      # 0x90ed
leaq 0x100(%rsp), %rdi
callq 0x3fe8
leaq 0x18(%rsp), %rdi
leaq 0x38(%rsp), %rsi
leaq 0x100(%rsp), %rdx
callq 0x3ed2
movl $0x2, 0x70(%rsp)
cmpq $0x0, 0x28(%rsp)
je 0x3b24
leaq 0x18(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq *0x18(%rdi)
movl %eax, %ebx
movq 0x28(%rsp), %rax
testq %rax, %rax
je 0x388f
leaq 0x18(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x100(%rsp), %rdi
cmpq %r14, %rdi
je 0x38ac
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x31b0
movq 0x9725(%rip), %rdi      # 0xcfd8
leaq 0x5834(%rip), %rsi      # 0x90ee
movl $0x1f, %edx
callq 0x31d0
movq 0x970d(%rip), %rdi      # 0xcfd8
movl %ebx, %esi
callq 0x3270
movq %rax, %rbx
leaq 0x5ccc(%rip), %rsi      # 0x95a8
movl $0x1, %edx
movq %rax, %rdi
callq 0x31d0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3190
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3100
leaq 0xf0(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x57eb(%rip), %rsi      # 0x910e
leaq 0x57f0(%rip), %rdx      # 0x911a
leaq 0xe0(%rsp), %rdi
callq 0x3fe8
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq 0x48(%rsp), %rcx
leaq 0x18(%rsp), %rdi
leaq 0xe0(%rsp), %r8
callq 0x5e1c
cmpq $0x0, 0x28(%rsp)
je 0x3b29
leaq 0x18(%rsp), %rdi
callq *0x18(%rdi)
movq 0x28(%rsp), %rax
testq %rax, %rax
je 0x3985
leaq 0x18(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0xe0(%rsp), %rdi
cmpq %r14, %rdi
je 0x39a2
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x31b0
leaq 0x28(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x5769(%rip), %rsi      # 0x911b
leaq 0x576c(%rip), %rdx      # 0x9125
leaq 0x18(%rsp), %rdi
callq 0x3fe8
leaq 0x70(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
leaq 0x18(%rsp), %rdx
callq 0x76ce
movq 0x18(%rsp), %rdi
cmpq %r14, %rdi
je 0x39f1
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x31b0
leaq 0xd0(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x5722(%rip), %rsi      # 0x9126
leaq 0x572c(%rip), %rdx      # 0x9137
leaq 0xc0(%rsp), %rdi
callq 0x3fe8
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq 0x48(%rsp), %rcx
leaq 0x18(%rsp), %rdi
leaq 0xc0(%rsp), %r8
callq 0x62e8
leaq 0x70(%rsp), %rdi
callq 0x72a4
movq %rax, 0x90(%rsp)
movl $0xa, 0x68(%rsp)
cmpq $0x0, 0x28(%rsp)
je 0x3b2e
leaq 0x18(%rsp), %rdi
leaq 0x90(%rsp), %rsi
leaq 0x68(%rsp), %rdx
callq *0x18(%rdi)
movq 0x28(%rsp), %rax
testq %rax, %rax
je 0x3a8d
leaq 0x18(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0xc0(%rsp), %rdi
cmpq %r14, %rdi
je 0x3aaa
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x31b0
leaq 0x18(%rsp), %rbx
movq $0x5, (%rbx)
movq $0x0, 0x8(%rbx)
movq %rbx, %rdi
movq %rbx, %rsi
callq 0x3080
cmpl $-0x1, %eax
jne 0x3ad8
callq 0x3040
cmpl $0x4, (%rax)
je 0x3abe
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x3ae7
callq 0x3f78
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x3af6
callq 0x3f78
leaq 0xa8(%rsp), %rdi
callq 0x7526
xorl %eax, %eax
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r14
retq
callq 0x30b0
callq 0x30b0
callq 0x30b0
callq 0x30b0
callq 0x30b0
callq 0x30b0
callq 0x30b0
jmp 0x3e06
jmp 0x3e06
jmp 0x3e06
jmp 0x3e06
jmp 0x3e06
jmp 0x3e06
jmp 0x3e06
jmp 0x3e06
movq %rax, %rbx
jmp 0x3d4f
jmp 0x3e0e
movq %rax, %rbx
movq 0x18(%rsp), %rdi
cmpq %r14, %rdi
je 0x3e20
movq 0x28(%rsp), %rsi
jmp 0x3c9b
jmp 0x3dc6
movq %rax, %rbx
jmp 0x3c46
jmp 0x3dc6
movq %rax, %rbx
jmp 0x3c82
jmp 0x3dc6
movq %rax, %rbx
jmp 0x3d8f
movq %rax, %rbx
jmp 0x3da9
jmp 0x3cad
movq %rax, %rbx
jmp 0x3de7
jmp 0x3cad
movq %rax, %rbx
jmp 0x3cd1
jmp 0x3cad
movq %rax, %rbx
jmp 0x3d10
jmp 0x3cad
movq %rax, %rbx
movq 0x180(%rsp), %rdi
cmpq %r14, %rdi
je 0x3e2f
movq 0x190(%rsp), %rsi
jmp 0x3dfc
jmp 0x3cad
movq %rax, %rbx
movq 0x1a0(%rsp), %rdi
cmpq %r14, %rdi
je 0x3e2f
movq 0x1b0(%rsp), %rsi
jmp 0x3dfc
jmp 0x3cad
movq %rax, %rbx
movq 0x28(%rsp), %rax
testq %rax, %rax
je 0x3c46
leaq 0x18(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0xe0(%rsp), %rdi
cmpq %r14, %rdi
je 0x3e20
movq 0xf0(%rsp), %rsi
jmp 0x3c9b
jmp 0x3e06
movq %rax, %rbx
movq 0x28(%rsp), %rax
testq %rax, %rax
je 0x3c82
leaq 0x18(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x100(%rsp), %rdi
cmpq %r14, %rdi
je 0x3e20
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x31b0
jmp 0x3e20
jmp 0x3e06
movq %rax, %rbx
jmp 0x3e2f
movq %rax, %rbx
movq 0x48(%rsp), %rax
testq %rax, %rax
je 0x3cd1
leaq 0x38(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x140(%rsp), %rdi
cmpq %r14, %rdi
je 0x3e2f
movq 0x150(%rsp), %rsi
jmp 0x3dfc
jmp 0x3e06
movq %rax, %rbx
movq 0x48(%rsp), %rax
testq %rax, %rax
je 0x3d10
leaq 0x38(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x160(%rsp), %rdi
cmpq %r14, %rdi
je 0x3e2f
movq 0x170(%rsp), %rsi
jmp 0x3dfc
jmp 0x3e06
movq %rax, %rbx
movq 0x28(%rsp), %rax
testq %rax, %rax
je 0x3d4f
leaq 0x18(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0xc0(%rsp), %rdi
cmpq %r14, %rdi
je 0x3e11
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x31b0
jmp 0x3e11
jmp 0x3e06
movq %rax, %rbx
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x3d8f
callq 0x3f78
movq 0x70(%rsp), %rdi
cmpq %r14, %rdi
je 0x3da9
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x31b0
movq 0x28(%rsp), %rax
testq %rax, %rax
je 0x3e2f
leaq 0x18(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x3e2f
jmp 0x3e06
movq %rax, %rbx
jmp 0x3e20
movq %rax, %rbx
movq 0x48(%rsp), %rax
testq %rax, %rax
je 0x3de7
leaq 0x38(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x120(%rsp), %rdi
cmpq %r14, %rdi
je 0x3e2f
movq 0x130(%rsp), %rsi
incq %rsi
callq 0x31b0
jmp 0x3e2f
movq %rax, %rdi
callq 0x3f6d
movq %rax, %rbx
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x3e20
callq 0x3f78
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x3e2f
callq 0x3f78
leaq 0xa8(%rsp), %rdi
callq 0x7526
movq %rbx, %rdi
callq 0x3280