// File: /workspace/github_cpp_makefile_star2_O1/hoehermann[P]TypedJNI/typedjni.cpp
// Function: TypedJNIString::TypedJNIString(JNIEnv_*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
TypedJNIString::TypedJNIString(JNIEnv *env, const std::string & str) {
    std::wstring_convert<std::codecvt_utf8_utf16<char16_t>,char16_t> convert; 
    std::u16string u16string = convert.from_bytes(str);
    if (u16string.size() > static_cast<size_t>(std::numeric_limits<jint>::max())) {
        throw TypedJNIError("Converted string length "+std::to_string(u16string.size())+" exceeds maximum "+std::to_string(std::numeric_limits<jint>::max())+".");
    }
    static_assert(sizeof(jchar) == sizeof(char16_t), "jchar is not as long as char16_t");
    jstring jstr = env->NewString(reinterpret_cast<const jchar*>(u16string.c_str()), static_cast<jint>(u16string.size()));
    if (jstr == NULL) {
        throw TypedJNIError("NewString failed for UTF-8 string '"+str+"'.");
    }
    jstrptr = std::shared_ptr<_jstring>(jstr, [this, env](jstring s){ 
        if (!persistent) { 
            env->DeleteLocalRef(s);
        }
    });
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movb $0x0, 0x10(%rdi)
movl $0x20, %edi
callq 0x31a0
xorl %ecx, %ecx
movl %ecx, 0x8(%rax)
movq $0x10ffff, 0x10(%rax)   # imm = 0x10FFFF
movl %ecx, 0x18(%rax)
leaq 0x5f45(%rip), %rdx      # 0xcd38
movq %rdx, (%rax)
leaq 0x100(%rsp), %rdx
movq %rax, -0x18(%rdx)
movq %rdx, -0x10(%rdx)
movq %rcx, -0x8(%rdx)
movb $0x0, (%rdx)
leaq 0x120(%rsp), %rax
movq %rax, -0x10(%rax)
movq %rcx, -0x8(%rax)
movw %cx, (%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movw %cx, 0x20(%rax)
movq (%r15), %rdx
movq 0x8(%r15), %rcx
addq %rdx, %rcx
leaq 0x48(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x7c6c
movq 0x50(%rsp), %rdx
testq $-0x80000000, %rdx      # imm = 0x80000000
jne 0x6ef8
movq 0x48(%rsp), %rsi
movq (%r14), %rax
movq %r14, %rdi
callq *0x518(%rax)
movq %rax, %r12
testq %rax, %rax
je 0x6f71
movl $0x28, %edi
callq 0x31a0
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x8(%rax)
leaq 0x5df3(%rip), %rcx      # 0xcc88
movq %rcx, (%rax)
movq %rbx, 0x10(%rax)
movq %r14, 0x18(%rax)
movq %r12, 0x20(%rax)
movq %r12, (%rbx)
movq 0x8(%rbx), %rdi
movq %rax, 0x8(%rbx)
testq %rdi, %rdi
je 0x6eb9
callq 0x3f78
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6ed9
movq 0x58(%rsp), %rax
leaq 0x2(,%rax,2), %rsi
callq 0x31b0
leaq 0xe8(%rsp), %rdi
callq 0x7afe
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x30e0
movq %rax, %r14
movq 0x50(%rsp), %rsi
leaq 0xa8(%rsp), %rdi
callq 0x79cc
leaq 0x263a(%rip), %rsi      # 0x9558
leaq 0xc8(%rsp), %rdi
leaq 0xa8(%rsp), %rdx
callq 0x795c
leaq 0x2637(%rip), %rsi      # 0x9571
leaq 0xc8(%rsp), %rdi
callq 0x32a0
leaq 0x78(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x7021
movups (%rcx), %xmm0
movups %xmm0, (%r12)
jmp 0x702e
movl $0x10, %edi
callq 0x30e0
movq %rax, %r14
leaq 0x25fe(%rip), %rsi      # 0x9583
leaq 0x28(%rsp), %rdi
movq %r15, %rdx
callq 0x782c
leaq 0x260e(%rip), %rsi      # 0x95a7
leaq 0x28(%rsp), %rdi
callq 0x32a0
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x6fc6
movups (%rcx), %xmm0
movups %xmm0, (%r12)
jmp 0x6fd3
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
movq 0x8(%rax), %rdx
leaq 0x8(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movb $0x1, %bpl
movq %r14, %rdi
callq 0x31f0
leaq 0x5bc7(%rip), %rax      # 0xcbc8
movq %rax, (%r14)
xorl %ebp, %ebp
leaq 0x5bd3(%rip), %rsi      # 0xcbe0
movq 0x5fb4(%rip), %rdx      # 0xcfc8
movq %r14, %rdi
callq 0x3260
jmp 0x70f8
movq %rdx, 0x68(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x78(%rsp)
movq 0x8(%rax), %rdx
movq %rdx, 0x70(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x88(%rsp), %rdi
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
callq 0x7a5c
leaq 0x28(%rsp), %rdi
leaq 0x68(%rsp), %rsi
leaq 0x88(%rsp), %rdx
callq 0x78b4
leaq 0x2532(%rip), %rsi      # 0x95a8
leaq 0x28(%rsp), %rdi
callq 0x32a0
leaq 0x18(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x70a2
movups (%rcx), %xmm0
movups %xmm0, (%r13)
jmp 0x70af
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
movq 0x8(%rax), %rdx
leaq 0x8(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movb $0x1, %bpl
movq %r14, %rdi
callq 0x31f0
leaq 0x5aeb(%rip), %rax      # 0xcbc8
movq %rax, (%r14)
xorl %ebp, %ebp
leaq 0x5af7(%rip), %rsi      # 0xcbe0
movq 0x5ed8(%rip), %rdx      # 0xcfc8
movq %r14, %rdi
callq 0x3260
movq %rax, %r15
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x711a
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x31b0
jmp 0x711a
movq %rax, %r15
movb $0x1, %bpl
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x713d
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x31b0
jmp 0x713d
movq %rax, %r15
movb $0x1, %bpl
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7166
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x31b0
jmp 0x7166
movq %rax, %r15
movb $0x1, %bpl
movq 0x68(%rsp), %rdi
cmpq %r12, %rdi
je 0x7185
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x31b0
jmp 0x7185
movq %rax, %r15
movb $0x1, %bpl
leaq 0xd8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x71e5
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x31b0
jmp 0x71e5
movq %rax, %r15
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x71ca
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x31b0
jmp 0x71ca
movq %rax, %r15
movb $0x1, %bpl
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7210
movq 0x38(%rsp), %rsi
jmp 0x71fe
movq %rax, %r15
movb $0x1, %bpl
leaq 0xb8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7210
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x31b0
jmp 0x7210
jmp 0x720a
movq %rax, %r15
movb $0x1, %bpl
testb %bpl, %bpl
je 0x7256
movq %r14, %rdi
callq 0x3120
jmp 0x7256
movq %rax, %rdi
callq 0x30c0
cmpb $0x0, 0x10(%rbx)
jne 0x723c
movq (%r14), %rax
movq %r14, %rdi
movq %r12, %rsi
callq *0xb8(%rax)
callq 0x3210
movq %rax, %r15
callq 0x3250
jmp 0x7256
movq %rax, %rdi
callq 0x3f6d
movq %rax, %r15
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x727b
movq 0x58(%rsp), %rax
leaq 0x2(,%rax,2), %rsi
callq 0x31b0
jmp 0x727b
movq %rax, %r15
leaq 0xe8(%rsp), %rdi
callq 0x7afe
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x7296
callq 0x3f78
movq %r15, %rdi
callq 0x3280
movq %rax, %r15
jmp 0x7288
nop