#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ iconv_t;
typedef int /*<<< orphan*/ dest;

/* Variables and functions */
int /*<<< orphan*/ iconv(int /*<<< orphan*/, char **, size_t *, char **,
                         size_t *);
int /*<<< orphan*/ iconv_open(char *, char *);
int main() {
  iconv_t i = iconv_open("UTF-16LE", "ISO-8859-1");
  size_t X, Y;
  char *x, *y;
  char src[] = "fnord";
  char dest[100];
  X = 6;
  Y = sizeof(dest);
  x = src;
  y = dest;
  iconv(i, &x, &X, &y, &Y);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
lea    0xece(%rip),%rdi
lea    0xed0(%rip),%rsi
call   1040 <iconv_open@plt>
mov    %eax,-0x4(%rbp)
mov    0xecd(%rip),%eax
mov    %eax,-0x2e(%rbp)
mov    0xec7(%rip),%ax
mov    %ax,-0x2a(%rbp)
movq   $0x6,-0x10(%rbp)
movq   $0x64,-0x18(%rbp)
lea    -0x2e(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0xa0(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x20(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x28(%rbp),%rcx
lea    -0x18(%rbp),%r8
call   1030 <iconv@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x98,%rsp
lea    0xed2(%rip),%rdi
lea    0xed4(%rip),%rsi
call   1040 <iconv_open@plt>
movw   $0x64,0xc(%rsp)
movl   $0x726f6e66,0x8(%rsp)
72
movq   $0x6,0x28(%rsp)
movq   $0x64,0x20(%rsp)
lea    0x8(%rsp),%rcx
mov    %rcx,0x18(%rsp)
lea    0x30(%rsp),%rcx
mov    %rcx,0x10(%rsp)
lea    0x18(%rsp),%rsi
lea    0x28(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0x20(%rsp),%r8
mov    %eax,%edi
call   1030 <iconv@plt>
xor    %eax,%eax
add    $0x98,%rsp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"UTF-16LE\00"
@.str.1 = [11 x i8] c"ISO-8859-1\00"
@__const.main.src = [6 x i8] c"fnord\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [6 x i8]
%7 = alloca [100 x i8]
%8 = call i32 @iconv_open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
store i32 %8, i32* %1
%9 = bitcast [6 x i8]* %6 to i8*
store i64 6, i64* %2
store i64 100, i64* %3
%10 = getelementptr inbounds [6 x i8], [6 x i8]* %6, i64 0, i64 0
store i8* %10, i8** %4
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
store i8* %11, i8** %5
%12 = load i32, i32* %1
%13 = call i32 @iconv(i32 %12, i8** %4, i64* %2, i8** %5, i64* %3)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"UTF-16LE\00"
@.str.1 = [11 x i8] c"ISO-8859-1\00"
@__const.main.src = [6 x i8] c"fnord\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [6 x i8]
%6 = alloca [100 x i8]
%7 = tail call i32 @iconv_open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%8 = bitcast i64* %1 to i8*
%9 = bitcast i64* %2 to i8*
%10 = bitcast i8** %3 to i8*
%11 = bitcast i8** %4 to i8*
%12 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
store i64 6, i64* %1
store i64 100, i64* %2
store i8* %12, i8** %3
store i8* %13, i8** %4
%14 = call i32 @iconv(i32 %7, i8** %3, i64* %1, i8** %4, i64* %2)
ret i32 0
}