int main() {
  int i, len;
  unsigned char buf[32];
  char str[1024];
  for (i = 0; i < 255; i++) {
    buf[0] = i;
    len = Disassemble(0, buf, str);
    printf("%d  %02x%02x%02x --> %s\n", len, buf[0], buf[1], buf[2], str);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xff,-0x8(%rbp)
jge    1196 <main+0x76>
mov    -0x8(%rbp),%eax
mov    %al,-0x30(%rbp)
lea    -0x30(%rbp),%rsi
lea    -0x430(%rbp),%rdx
xor    %edi,%edi
mov    $0x0,%al
call   1040 <Disassemble@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
movzbl -0x30(%rbp),%edx
movzbl -0x2f(%rbp),%ecx
movzbl -0x2e(%rbp),%r8d
lea    -0x430(%rbp),%r9
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1139 <main+0x19>
xor    %eax,%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x428,%rsp
mov    %rsp,%r14
lea    0x20(%rsp),%rbx
lea    0xec4(%rip),%r15
xor    %ebp,%ebp
xchg   %ax,%ax
mov    %bpl,(%rsp)
xor    %edi,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <Disassemble@plt>
movzbl (%rsp),%edx
movzbl 0x1(%rsp),%ecx
movzbl 0x2(%rsp),%r8d
mov    %r15,%rdi
mov    %eax,%esi
mov    %rbx,%r9
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    $0xff,%ebp
jne    1140 <main+0x20>
xor    %eax,%eax
add    $0x428,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [25 x i8] c"%d %02x%02x%02x --> %s\0A\00"
define i32 @main() {
%1 = alloca [32 x i8]
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 1
%6 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 2
br label %7
7: ; preds = %0, %7
%8 = phi i32 [ 0, %0 ], [ %18, %7 ]
%9 = trunc i32 %8 to i8
store i8 %9, i8* %3
%10 = call i32 (i32, i8*, i8*, ...) bitcast (i32 (...)* @Disassemble to i32 (i32, i8*, i8*, ...)*)(i32 0, i8* %3, i8* %4)
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = load i8, i8* %5
%14 = zext i8 %13 to i32
%15 = load i8, i8* %6
%16 = zext i8 %15 to i32
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %12, i32 %14, i32 %16, i8* %4)
%18 = add nuw nsw i32 %8, 1
%19 = icmp eq i32 %18, 255
br i1 %19, label %20, label %7
20: ; preds = %7
ret i32 0
}