#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 */

/* Variables and functions */
char *ckctox(unsigned char, int);
int /*<<< orphan*/ printf(char *, char *);
main() {
  int i;
  unsigned char c;
  for (i = 0; i < 256; i++) {
    c = i & 0xff;
    printf("%s", ckctox(c, 0));
    printf("%s", ckctox(c, 1));
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x100,-0x8(%rbp)
jge    1193 <main+0x73>
mov    -0x8(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x9(%rbp)
xor    %esi,%esi
movzbl -0x9(%rbp),%edi
call   1040 <ckctox@plt>
mov    %rax,%rsi
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%esi
movzbl -0x9(%rbp),%edi
call   1040 <ckctox@plt>
mov    %rax,%rsi
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %ebx,%ebx
lea    0xed3(%rip),%r14
nopl   (%rax)
movzbl %bl,%ebp
mov    %ebp,%edi
xor    %esi,%esi
call   1040 <ckctox@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    %ebp,%edi
mov    $0x1,%esi
call   1040 <ckctox@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x100,%ebx
jne    1130 <main+0x10>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
store i32 0, i32* %1
store i32 0, i32* %2
br label %4
4: ; preds = %17, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 256
br i1 %6, label %7, label %20
7: ; preds = %4
%8 = load i32, i32* %2
%9 = and i32 %8, 255
%10 = trunc i32 %9 to i8
store i8 %10, i8* %3
%11 = load i8, i8* %3
%12 = call i8* @ckctox(i8 zeroext %11, i32 0)
%13 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = load i8, i8* %3
%15 = call i8* @ckctox(i8 zeroext %14, i32 1)
%16 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %15)
br label %17
17: ; preds = %7
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
store i32 %19, i32* %2
br label %4
20: ; preds = %4
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %8, %1 ]
%3 = trunc i32 %2 to i8
%4 = tail call i8* @ckctox(i8 zeroext %3, i32 0)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = tail call i8* @ckctox(i8 zeroext %3, i32 1)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = add nuw nsw i32 %2, 1
%9 = icmp eq i32 %8, 256
br i1 %9, label %10, label %1
10: ; preds = %1
ret i32 0
}