int main(argc, argv)
int argc;
char *argv[];
{
  register int i;
  for (i = 0; i <= 0xFF; ++i) {
    char *s;
    s = BcdToStr(i);
    i = StrToBcd(s);
    printf("0x%02x %03d 0%03o \"%s\"\n", i, i, i, s);
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xff,-0x14(%rbp)
jg     11a1 <main+0x71>
mov    -0x14(%rbp),%edi
mov    $0x0,%al
call   1050 <BcdToStr@plt>
cltq
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x0,%al
call   1030 <StrToBcd@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x20(%rbp),%r8
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
lea    0xec4(%rip),%r14
xor    %edi,%edi
xchg   %ax,%ax
xor    %eax,%eax
call   1050 <BcdToStr@plt>
movslq %eax,%r15
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <StrToBcd@plt>
mov    %eax,%ebx
mov    %r14,%rdi
mov    %eax,%esi
mov    %eax,%edx
mov    %eax,%ecx
mov    %r15,%r8
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x1(%rbx),%edi
cmp    $0xff,%ebx
jl     1140 <main+0x10>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [24 x i8] c"0x%02x %03d 0%03o \22%s\22\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
br label %8
8: ; preds = %23, %2
%9 = load i32, i32* %6
%10 = icmp sle i32 %9, 255
br i1 %10, label %11, label %26
11: ; preds = %8
%12 = load i32, i32* %6
%13 = call i32 (i32, ...) bitcast (i32 (...)* @BcdToStr to i32 (i32, ...)*)(i32 %12)
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to i8*
store i8* %15, i8** %7
%16 = load i8*, i8** %7
%17 = call i32 (i8*, ...) bitcast (i32 (...)* @StrToBcd to i32 (i8*, ...)*)(i8* %16)
store i32 %17, i32* %6
%18 = load i32, i32* %6
%19 = load i32, i32* %6
%20 = load i32, i32* %6
%21 = load i8*, i8** %7
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %18, i32 %19, i32 %20, i8* %21)
br label %23
23: ; preds = %11
%24 = load i32, i32* %6
%25 = add nsw i32 %24, 1
store i32 %25, i32* %6
br label %8
26: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"0x%02x %03d 0%03o \22%s\22\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %2, %3
%4 = phi i32 [ 0, %2 ], [ %10, %3 ]
%5 = tail call i32 (i32, ...) bitcast (i32 (...)* @BcdToStr to i32 (i32, ...)*)(i32 %4)
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i8*
%8 = tail call i32 (i8*, ...) bitcast (i32 (...)* @StrToBcd to i32 (i8*, ...)*)(i8* %7)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %8, i32 %8, i8* %7)
%10 = add nsw i32 %8, 1
%11 = icmp slt i32 %8, 255
br i1 %11, label %3, label %12
12: ; preds = %3
ret i32 0
}