#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;

/* Variables and functions */
int /*<<< orphan*/ iconv_close(int /*<<< orphan*/);
int /*<<< orphan*/ puts(char *);
int xiconv(int /*<<< orphan*/, int);
int /*<<< orphan*/ xiconv_open(char *);
int main(void) {
  iconv_t cd;
  int result = 0;
  cd = xiconv_open("EUC-TW");
  result |= xiconv(cd, 4) == true;
  puts("---");
  result |= xiconv(cd, 1) == true;
  puts("---");
  iconv_close(cd);
  cd = xiconv_open("EUC-JP");
  result |= xiconv(cd, 4) == true;
  puts("---");
  result |= xiconv(cd, 1) == true;
  puts("---");
  iconv_close(cd);
  return result;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xea3(%rip),%rdi
call   1060 <xiconv_open@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x4,%esi
call   1040 <xiconv@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
lea    0xe7d(%rip),%rdi
call   1030 <puts@plt>
mov    -0x8(%rbp),%edi
mov    $0x1,%esi
call   1040 <xiconv@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
lea    0xe53(%rip),%rdi
call   1030 <puts@plt>
mov    -0x8(%rbp),%edi
call   1050 <iconv_close@plt>
lea    0xe43(%rip),%rdi
call   1060 <xiconv_open@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x4,%esi
call   1040 <xiconv@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
lea    0xe12(%rip),%rdi
call   1030 <puts@plt>
mov    -0x8(%rbp),%edi
mov    $0x1,%esi
call   1040 <xiconv@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
lea    0xde8(%rip),%rdi
call   1030 <puts@plt>
mov    -0x8(%rbp),%edi
call   1050 <iconv_close@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xeb2(%rip),%rdi
call   1060 <xiconv_open@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    $0x4,%esi
call   1040 <xiconv@plt>
cmp    $0x1,%eax
sete   %r15b
lea    0xe98(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %ebp,%edi
mov    $0x1,%esi
call   1040 <xiconv@plt>
cmp    $0x1,%eax
sete   %bl
or     %r15b,%bl
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %ebp,%edi
call   1050 <iconv_close@plt>
lea    0xe69(%rip),%rdi
call   1060 <xiconv_open@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    $0x4,%esi
call   1040 <xiconv@plt>
cmp    $0x1,%eax
sete   %r15b
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %ebp,%edi
mov    $0x1,%esi
call   1040 <xiconv@plt>
cmp    $0x1,%eax
sete   %al
or     %r15b,%al
or     %bl,%al
movzbl %al,%ebx
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %ebp,%edi
call   1050 <iconv_close@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"EUC-TW\00"
@.str.1 = [4 x i8] c"---\00"
@.str.2 = [7 x i8] c"EUC-JP\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
%4 = call i32 @xiconv_open(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @xiconv(i32 %5, i32 4)
%7 = icmp eq i32 %6, 1
%8 = zext i1 %7 to i32
%9 = load i32, i32* %3
%10 = or i32 %9, %8
store i32 %10, i32* %3
%11 = call i32 @puts(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%12 = load i32, i32* %2
%13 = call i32 @xiconv(i32 %12, i32 1)
%14 = icmp eq i32 %13, 1
%15 = zext i1 %14 to i32
%16 = load i32, i32* %3
%17 = or i32 %16, %15
store i32 %17, i32* %3
%18 = call i32 @puts(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%19 = load i32, i32* %2
%20 = call i32 @iconv_close(i32 %19)
%21 = call i32 @xiconv_open(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
store i32 %21, i32* %2
%22 = load i32, i32* %2
%23 = call i32 @xiconv(i32 %22, i32 4)
%24 = icmp eq i32 %23, 1
%25 = zext i1 %24 to i32
%26 = load i32, i32* %3
%27 = or i32 %26, %25
store i32 %27, i32* %3
%28 = call i32 @puts(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%29 = load i32, i32* %2
%30 = call i32 @xiconv(i32 %29, i32 1)
%31 = icmp eq i32 %30, 1
%32 = zext i1 %31 to i32
%33 = load i32, i32* %3
%34 = or i32 %33, %32
store i32 %34, i32* %3
%35 = call i32 @puts(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%36 = load i32, i32* %2
%37 = call i32 @iconv_close(i32 %36)
%38 = load i32, i32* %3
ret i32 %38
}

LLVM IR (-O2):
@.str = [7 x i8] c"EUC-TW\00"
@.str.1 = [4 x i8] c"---\00"
@.str.2 = [7 x i8] c"EUC-JP\00"
define i32 @main() {
%1 = tail call i32 @xiconv_open(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @xiconv(i32 %1, i32 4)
%3 = icmp eq i32 %2, 1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @xiconv(i32 %1, i32 1)
%6 = icmp eq i32 %5, 1
%7 = or i1 %3, %6
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 @iconv_close(i32 %1)
%10 = tail call i32 @xiconv_open(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%11 = tail call i32 @xiconv(i32 %10, i32 4)
%12 = icmp eq i32 %11, 1
%13 = or i1 %7, %12
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%15 = tail call i32 @xiconv(i32 %10, i32 1)
%16 = icmp eq i32 %15, 1
%17 = or i1 %13, %16
%18 = zext i1 %17 to i32
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%20 = tail call i32 @iconv_close(i32 %10)
ret i32 %18
}