#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*/ outbuf;
typedef scalar_t__ iconv_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
size_t iconv(scalar_t__, char **, size_t *, char **, size_t *);
int /*<<< orphan*/ iconv_close(scalar_t__);
scalar_t__ iconv_open(char *, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  iconv_t cd;
  int i;
  cd = iconv_open("utf-8", "windows-1250");
  if (cd == (iconv_t)(-1)) {
    perror("iconv_open");
    exit(1);
  }
  for (i = 128; i < 256; i++) {
    char inbuf[2], outbuf[16], *in, *out;
    size_t inbytes, outbytes, res;
    inbuf[0] = i;
    inbuf[1] = 0;
    inbytes = 1;
    in = inbuf;
    outbuf[0] = 0;
    outbytes = sizeof(outbuf) - 1;
    out = outbuf;
    res = iconv(cd, &in, &inbytes, &out, &outbytes);
    *out = 0;
    if ((i % 8) == 0)
      printf("\t");
    if (res == (size_t)(-1))
      printf("\"?\", ");
    else
      printf("\"%s\", ", outbuf);
    if ((i % 8) == 7)
      printf("\n");
  }
  iconv_close(cd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
lea    0xe89(%rip),%rsi
call   1080 <iconv_open@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0xffffffffffffffff,-0x10(%rbp)
jne    11a7 <main+0x47>
lea    0xe7b(%rip),%rdi
call   1060 <perror@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
movl   $0x80,-0x14(%rbp)
cmpl   $0x100,-0x14(%rbp)
jge    1294 <main+0x134>
mov    -0x14(%rbp),%eax
mov    %al,-0x16(%rbp)
movb   $0x0,-0x15(%rbp)
movq   $0x1,-0x48(%rbp)
lea    -0x16(%rbp),%rax
mov    %rax,-0x38(%rbp)
movb   $0x0,-0x30(%rbp)
movq   $0xf,-0x50(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x38(%rbp),%rsi
lea    -0x48(%rbp),%rdx
lea    -0x40(%rbp),%rcx
lea    -0x50(%rbp),%r8
call   1030 <iconv@plt>
mov    %rax,-0x58(%rbp)
mov    -0x40(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x14(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    122f <main+0xcf>
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpq   $0xffffffffffffffff,-0x58(%rbp)
jne    124d <main+0xed>
lea    0xddf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    125f <main+0xff>
lea    -0x30(%rbp),%rsi
lea    0xdce(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x7,%edx
jne    1281 <main+0x121>
lea    0xdb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1286 <main+0x126>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ae <main+0x4e>
mov    -0x10(%rbp),%rdi
call   1050 <iconv_close@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
lea    0xe7b(%rip),%rdi
lea    0xe7a(%rip),%rsi
call   1090 <iconv_open@plt>
cmp    $0xffffffffffffffff,%rax
je     12a0 <main+0x130>
mov    %rax,%rbx
mov    $0x80,%r12d
lea    0x30(%rsp),%r14
lea    0x18(%rsp),%rbp
jmp    11c1 <main+0x51>
add    $0x1,%r12d
cmp    $0x100,%r12d
je     1287 <main+0x117>
mov    %r12b,0xe(%rsp)
movb   $0x0,0xf(%rsp)
movq   $0x1,0x20(%rsp)
lea    0xe(%rsp),%rax
mov    %rax,0x28(%rsp)
movb   $0x0,0x30(%rsp)
movq   $0xf,0x18(%rsp)
mov    %r14,0x10(%rsp)
mov    %rbx,%rdi
lea    0x28(%rsp),%rsi
lea    0x20(%rsp),%rdx
lea    0x10(%rsp),%rcx
mov    %rbp,%r8
call   1040 <iconv@plt>
mov    %rax,%r15
mov    0x10(%rsp),%rax
movb   $0x0,(%rax)
mov    %r12d,%r13d
and    $0x7,%r13d
je     1250 <main+0xe0>
cmp    $0xffffffffffffffff,%r15
je     1260 <main+0xf0>
lea    0xdf8(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x7,%r13d
jne    11b0 <main+0x40>
jmp    1278 <main+0x108>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x9,%edi
call   1030 <putchar@plt>
cmp    $0xffffffffffffffff,%r15
jne    1225 <main+0xb5>
lea    0xdb7(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x7,%r13d
jne    11b0 <main+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    11b0 <main+0x40>
mov    %rbx,%rdi
call   1060 <iconv_close@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd6c(%rip),%rdi
call   1070 <perror@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"utf-8\00"
@.str.1 = [13 x i8] c"windows-1250\00"
@.str.2 = [11 x i8] c"iconv_open\00"
@.str.3 = [2 x i8] c"\09\00"
@.str.4 = [6 x i8] c"\22?\22, \00"
@.str.5 = [7 x i8] c"\22%s\22, \00"
@.str.6 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i32
%4 = alloca [2 x i8]
%5 = alloca [16 x i8]
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
store i32 0, i32* %1
%11 = call i64 @iconv_open(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
store i64 %11, i64* %2
%12 = load i64, i64* %2
%13 = icmp eq i64 %12, -1
br i1 %13, label %14, label %17
14: ; preds = %0
%15 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %0
store i32 128, i32* %3
br label %18
18: ; preds = %52, %17
%19 = load i32, i32* %3
%20 = icmp slt i32 %19, 256
br i1 %20, label %21, label %55
21: ; preds = %18
%22 = load i32, i32* %3
%23 = trunc i32 %22 to i8
%24 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
store i8 %23, i8* %24
%25 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 1
store i8 0, i8* %25
store i64 1, i64* %8
%26 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
store i8* %26, i8** %6
%27 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
store i8 0, i8* %27
store i64 15, i64* %9
%28 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
store i8* %28, i8** %7
%29 = load i64, i64* %2
%30 = call i64 @iconv(i64 %29, i8** %6, i64* %8, i8** %7, i64* %9)
store i64 %30, i64* %10
%31 = load i8*, i8** %7
store i8 0, i8* %31
%32 = load i32, i32* %3
%33 = srem i32 %32, 8
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %37
35: ; preds = %21
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %37
37: ; preds = %35, %21
%38 = load i64, i64* %10
%39 = icmp eq i64 %38, -1
br i1 %39, label %40, label %42
40: ; preds = %37
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %45
42: ; preds = %37
%43 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %43)
br label %45
45: ; preds = %42, %40
%46 = load i32, i32* %3
%47 = srem i32 %46, 8
%48 = icmp eq i32 %47, 7
br i1 %48, label %49, label %51
49: ; preds = %45
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %51
51: ; preds = %49, %45
br label %52
52: ; preds = %51
%53 = load i32, i32* %3
%54 = add nsw i32 %53, 1
store i32 %54, i32* %3
br label %18
55: ; preds = %18
%56 = load i64, i64* %2
%57 = call i32 @iconv_close(i64 %56)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"utf-8\00"
@.str.1 = [13 x i8] c"windows-1250\00"
@.str.2 = [11 x i8] c"iconv_open\00"
@.str.4 = [6 x i8] c"\22?\22, \00"
@.str.5 = [7 x i8] c"\22%s\22, \00"
define i32 @main() {
%1 = alloca [2 x i8]
%2 = alloca [16 x i8]
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
%7 = tail call i64 @iconv_open(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i64 %7, -1
br i1 %8, label %17, label %9
9: ; preds = %0
%10 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 0
%11 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%12 = bitcast i8** %3 to i8*
%13 = bitcast i8** %4 to i8*
%14 = bitcast i64* %5 to i8*
%15 = bitcast i64* %6 to i8*
%16 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 1
br label %20
17: ; preds = %0
%18 = tail call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%19 = tail call i32 @exit(i32 1)
unreachable
20: ; preds = %9, %39
%21 = phi i32 [ 128, %9 ], [ %40, %39 ]
%22 = trunc i32 %21 to i8
store i8 %22, i8* %10
store i8 0, i8* %16
store i64 1, i64* %5
store i8* %10, i8** %3
store i8 0, i8* %11
store i64 15, i64* %6
store i8* %11, i8** %4
%23 = call i64 @iconv(i64 %7, i8** %3, i64* %5, i8** %4, i64* %6)
%24 = load i8*, i8** %4
store i8 0, i8* %24
%25 = and i32 %21, 7
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %20
%28 = call i32 @putchar(i32 9)
br label %29
29: ; preds = %27, %20
%30 = icmp eq i64 %23, -1
br i1 %30, label %31, label %33
31: ; preds = %29
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %35
33: ; preds = %29
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %11)
br label %35
35: ; preds = %33, %31
%36 = icmp eq i32 %25, 7
br i1 %36, label %37, label %39
37: ; preds = %35
%38 = call i32 @putchar(i32 10)
br label %39
39: ; preds = %37, %35
%40 = add nuw nsw i32 %21, 1
%41 = icmp eq i32 %40, 256
br i1 %41, label %42, label %20
42: ; preds = %39
%43 = call i32 @iconv_close(i64 %7)
ret i32 0
}