// File: /workspace/github_c_makefile_star2_O1/videolan[P]bitstream/examples/dvb_print_si.c
// Function: iconv_wrapper
static char *iconv_wrapper(void *_unused, const char *psz_encoding,
                           char *p_string, size_t i_length)
{
    char *psz_string, *p;
    size_t i_out_length;

    if (!strcmp(psz_encoding, psz_native_encoding))
        return iconv_append_null(p_string, i_length);

    if (iconv_handle != (iconv_t)-1 &&
        strcmp(psz_encoding, psz_current_encoding)) {
        iconv_close(iconv_handle);
        iconv_handle = (iconv_t)-1;
    }

    if (iconv_handle == (iconv_t)-1)
        iconv_handle = iconv_open(psz_native_encoding, psz_encoding);
    if (iconv_handle == (iconv_t)-1) {
        fprintf(stderr, "couldn't initiate conversion from %s to %s (%m)\n",
                psz_encoding, psz_native_encoding);
        return iconv_append_null(p_string, i_length);
    }
    psz_current_encoding = psz_encoding;

    /* converted strings can be up to six times larger */
    i_out_length = i_length * 6;
    p = psz_string = malloc(i_out_length);
    if (iconv(iconv_handle, &p_string, &i_length, &p, &i_out_length) == -1) {
        fprintf(stderr, "couldn't convert from %s to %s (%m)\n", psz_encoding,
                psz_native_encoding);
        free(psz_string);
        return iconv_append_null(p_string, i_length);
    }
    if (i_length)
        fprintf(stderr, "partial conversion from %s to %s\n", psz_encoding,
                psz_native_encoding);

    *p = '\0';
    return psz_string;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %rbx
movq %rdx, 0x8(%rsp)
movq %rcx, (%rsp)
leaq 0x4187(%rip), %rsi      # 0x15877
movq %rbx, %rdi
callq 0x3120
testl %eax, %eax
je 0x117bd
movq 0xca19(%rip), %r14      # 0x1e120
cmpq $-0x1, %r14
je 0x11733
movq 0xca14(%rip), %rsi      # 0x1e128
movq %rbx, %rdi
callq 0x3120
testl %eax, %eax
je 0x11733
movq %r14, %rdi
callq 0x31a0
movq $-0x1, 0xc9ed(%rip) # 0x1e120
cmpq $-0x1, 0xc9e5(%rip)     # 0x1e120
jne 0x11753
leaq 0x4133(%rip), %rdi      # 0x15877
movq %rbx, %rsi
callq 0x3210
movq %rax, 0xc9cd(%rip)      # 0x1e120
movq 0xc9c6(%rip), %r15      # 0x1e120
cmpq $-0x1, %r15
je 0x117f1
movq %rbx, 0xc9bd(%rip)      # 0x1e128
movq %rsp, %r12
movq (%r12), %rax
addq %rax, %rax
leaq (%rax,%rax,2), %rdi
leaq 0x18(%rsp), %r13
movq %rdi, (%r13)
callq 0x3160
movq %rax, %r14
leaq 0x10(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
movq %r12, %rdx
movq %r13, %r8
callq 0x3060
cmpq $-0x1, %rax
je 0x11815
cmpq $0x0, (%rsp)
jne 0x1185f
movq 0x10(%rsp), %rax
jmp 0x117dd
leaq 0x1(%r15), %rdi
callq 0x3160
movq %rax, %r14
movq %rax, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x3150
movq %r14, %rax
addq %r15, %rax
movb $0x0, (%rax)
movq %r14, %rax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0xc7f8(%rip), %rax      # 0x1dff0
movq (%rax), %rdi
leaq 0x8430(%rip), %rsi      # 0x19c32
leaq 0x406e(%rip), %rcx      # 0x15877
movq %rbx, %rdx
xorl %eax, %eax
callq 0x3130
jmp 0x1183f
movq 0xc7d4(%rip), %rax      # 0x1dff0
movq (%rax), %rdi
leaq 0x843d(%rip), %rsi      # 0x19c63
leaq 0x404a(%rip), %rcx      # 0x15877
movq %rbx, %rdx
xorl %eax, %eax
callq 0x3130
movq %r14, %rdi
callq 0x3030
movq 0x8(%rsp), %rbx
movq (%rsp), %r15
leaq 0x1(%r15), %rdi
callq 0x3160
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
jmp 0x117cf
movq 0xc78a(%rip), %rax      # 0x1dff0
movq (%rax), %rdi
leaq 0x8418(%rip), %rsi      # 0x19c88
leaq 0x4000(%rip), %rcx      # 0x15877
movq %rbx, %rdx
xorl %eax, %eax
callq 0x3130
jmp 0x117b6