// File: /workspace/github_c_makefile_star2_O3/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, %r14
movq %rdx, %r12
movq %rsi, %rbx
movq %rdx, 0x8(%rsp)
movq %rcx, (%rsp)
leaq 0x40a9(%rip), %rsi      # 0x14937
movq %rbx, %rdi
callq 0x2120
testl %eax, %eax
je 0x109d1
movq 0xc87b(%rip), %r13      # 0x1d120
cmpq $-0x1, %r13
je 0x108d1
movq 0xc876(%rip), %rsi      # 0x1d128
movq %rbx, %rdi
callq 0x2120
testl %eax, %eax
je 0x108f4
movq %r13, %rdi
callq 0x21a0
movq $-0x1, 0xc84f(%rip) # 0x1d120
leaq 0x405f(%rip), %rdi      # 0x14937
movq %rbx, %rsi
callq 0x2210
movq %rax, %r13
movq %rax, 0xc836(%rip)      # 0x1d120
cmpq $-0x1, %rax
je 0x109af
movq %rbx, 0xc82d(%rip)      # 0x1d128
addq %r14, %r14
leaq (%r14,%r14,2), %rdi
leaq 0x18(%rsp), %r14
movq %rdi, (%r14)
callq 0x2160
movq %rax, %r15
leaq 0x10(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x8(%rsp), %rsi
movq %rsp, %rdx
movq %r13, %rdi
movq %r14, %r8
callq 0x2060
cmpq $-0x1, %rax
je 0x10944
cmpq $0x0, (%rsp)
jne 0x1098b
movq 0x10(%rsp), %rax
jmp 0x109f1
movq 0xc6a5(%rip), %rax      # 0x1cff0
movq (%rax), %rdi
leaq 0x83ce(%rip), %rsi      # 0x18d23
leaq 0x3fdb(%rip), %rcx      # 0x14937
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2130
movq %r15, %rdi
callq 0x2030
movq 0x8(%rsp), %rbx
movq (%rsp), %r14
leaq 0x1(%r14), %rdi
callq 0x2160
movq %rax, %r15
movq %rax, %rdi
movq %rbx, %rsi
jmp 0x109e3
movq 0xc65e(%rip), %rax      # 0x1cff0
movq (%rax), %rdi
leaq 0x83ac(%rip), %rsi      # 0x18d48
leaq 0x3f94(%rip), %rcx      # 0x14937
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2130
jmp 0x1093a
movq 0xc63a(%rip), %rax      # 0x1cff0
movq (%rax), %rdi
leaq 0x8332(%rip), %rsi      # 0x18cf2
leaq 0x3f70(%rip), %rcx      # 0x14937
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2130
leaq 0x1(%r14), %rdi
callq 0x2160
movq %rax, %r15
movq %rax, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x2150
movq %r15, %rax
addq %r14, %rax
movb $0x0, (%rax)
movq %r15, %rax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq