#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 */
int fread(unsigned char *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int main(int argc, char **argv) {
  int i, j, k;
  unsigned char temp;
  for (i = 0; i < 256; i++) {
    if ((i >= 0x20) && (i < 127))
      printf("Char : 0x%x %c\n", i, i);
    else
      printf("Char : 0x%x\n", i);
    for (j = 0; j < 16; j++) {
      if (fread(&temp, 1, 1, stdin) < 1)
        return -1;
      printf("0x%02x : ", temp);
      for (k = 0; k < 8; k++) {
        if ((1 << (7 - k)) & temp) {
          printf("#");
        } else {
          printf(" ");
        }
      }
      printf("\n");
    }
  }
  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   $0x100,-0x14(%rbp)
jge    126b <main+0x14b>
cmpl   $0x20,-0x14(%rbp)
jl     1177 <main+0x57>
cmpl   $0x7f,-0x14(%rbp)
jge    1177 <main+0x57>
mov    -0x14(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1188 <main+0x68>
mov    -0x14(%rbp),%esi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x10,-0x18(%rbp)
jge    1258 <main+0x138>
mov    0x2e48(%rip),%rax
mov    (%rax),%ecx
lea    -0x1d(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
cmp    $0x1,%eax
jge    11c7 <main+0xa7>
movl   $0xffffffff,-0x4(%rbp)
jmp    1272 <main+0x152>
movzbl -0x1d(%rbp),%esi
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x8,-0x1c(%rbp)
jge    123c <main+0x11c>
mov    $0x7,%ecx
sub    -0x1c(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
movzbl -0x1d(%rbp),%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     121b <main+0xfb>
lea    0xe18(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1229 <main+0x109>
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    122e <main+0x10e>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11e0 <main+0xc0>
lea    0xdcb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    118f <main+0x6f>
jmp    125d <main+0x13d>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113d <main+0x1d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x2ea6(%rip),%rbp
lea    0x7(%rsp),%rbx
lea    0xecf(%rip),%r15
lea    0xebb(%rip),%r12
xor    %r13d,%r13d
lea    -0x20(%r13),%eax
cmp    $0x5e,%eax
ja     1180 <main+0x50>
lea    0xe98(%rip),%rdi
mov    %r13d,%esi
mov    %r13d,%edx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    118d <main+0x5d>
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x10,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x0(%rbp),%ecx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
call   1040 <fread@plt>
test   %eax,%eax
jle    12ad <main+0x17d>
movzbl 0x7(%rsp),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x7(%rsp),%eax
shr    $0x7,%al
movzbl %al,%eax
lea    (%rax,%rax,2),%edi
or     $0x20,%edi
call   1030 <putchar@plt>
movzbl 0x7(%rsp),%eax
and    $0x40,%al
shr    $0x6,%al
movzbl %al,%eax
lea    (%rax,%rax,2),%edi
or     $0x20,%edi
call   1030 <putchar@plt>
movzbl 0x7(%rsp),%eax
and    $0x20,%al
shr    $0x5,%al
movzbl %al,%eax
lea    (%rax,%rax,2),%edi
or     $0x20,%edi
call   1030 <putchar@plt>
movzbl 0x7(%rsp),%eax
and    $0x10,%al
shr    $0x4,%al
movzbl %al,%eax
lea    (%rax,%rax,2),%edi
or     $0x20,%edi
call   1030 <putchar@plt>
movzbl 0x7(%rsp),%eax
and    $0x8,%al
shr    $0x3,%al
movzbl %al,%eax
lea    (%rax,%rax,2),%edi
or     $0x20,%edi
call   1030 <putchar@plt>
movzbl 0x7(%rsp),%eax
and    $0x4,%al
shr    $0x2,%al
movzbl %al,%eax
lea    (%rax,%rax,2),%edi
or     $0x20,%edi
call   1030 <putchar@plt>
movzbl 0x7(%rsp),%eax
and    $0x2,%al
shr    %al
movzbl %al,%eax
lea    (%rax,%rax,2),%edi
or     $0x20,%edi
call   1030 <putchar@plt>
movzbl 0x7(%rsp),%eax
and    $0x1,%eax
lea    (%rax,%rax,2),%edi
or     $0x20,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%r14d
jne    11a0 <main+0x70>
add    $0x1,%r13d
cmp    $0x100,%r13d
jne    1158 <main+0x28>
xor    %eax,%eax
jmp    12b2 <main+0x182>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Char : 0x%x %c\0A\00"
@.str.1 = [13 x i8] c"Char : 0x%x\0A\00"
@stdin = global i32 0
@.str.2 = [10 x i8] c"0x%02x : \00"
@.str.3 = [2 x i8] c"#\00"
@.str.4 = [2 x i8] c" \00"
@.str.5 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
br label %10
10: ; preds = %64, %2
%11 = load i32, i32* %6
%12 = icmp slt i32 %11, 256
br i1 %12, label %13, label %67
13: ; preds = %10
%14 = load i32, i32* %6
%15 = icmp sge i32 %14, 32
br i1 %15, label %16, label %23
16: ; preds = %13
%17 = load i32, i32* %6
%18 = icmp slt i32 %17, 127
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = load i32, i32* %6
%21 = load i32, i32* %6
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %20, i32 %21)
br label %26
23: ; preds = %16, %13
%24 = load i32, i32* %6
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %23, %19
store i32 0, i32* %7
br label %27
27: ; preds = %60, %26
%28 = load i32, i32* %7
%29 = icmp slt i32 %28, 16
br i1 %29, label %30, label %63
30: ; preds = %27
%31 = load i32, i32* @stdin
%32 = call i32 @fread(i8* %9, i32 1, i32 1, i32 %31)
%33 = icmp slt i32 %32, 1
br i1 %33, label %34, label %35
34: ; preds = %30
store i32 -1, i32* %3
br label %68
35: ; preds = %30
%36 = load i8, i8* %9
%37 = zext i8 %36 to i32
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %37)
store i32 0, i32* %8
br label %39
39: ; preds = %55, %35
%40 = load i32, i32* %8
%41 = icmp slt i32 %40, 8
br i1 %41, label %42, label %58
42: ; preds = %39
%43 = load i32, i32* %8
%44 = sub nsw i32 7, %43
%45 = shl i32 1, %44
%46 = load i8, i8* %9
%47 = zext i8 %46 to i32
%48 = and i32 %45, %47
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %42
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %54
52: ; preds = %42
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %54
54: ; preds = %52, %50
br label %55
55: ; preds = %54
%56 = load i32, i32* %8
%57 = add nsw i32 %56, 1
store i32 %57, i32* %8
br label %39
58: ; preds = %39
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %60
60: ; preds = %58
%61 = load i32, i32* %7
%62 = add nsw i32 %61, 1
store i32 %62, i32* %7
br label %27
63: ; preds = %27
br label %64
64: ; preds = %63
%65 = load i32, i32* %6
%66 = add nsw i32 %65, 1
store i32 %66, i32* %6
br label %10
67: ; preds = %10
store i32 0, i32* %3
br label %68
68: ; preds = %67, %34
%69 = load i32, i32* %3
ret i32 %69
}

LLVM IR (-O2):
@.str = [16 x i8] c"Char : 0x%x %c\0A\00"
@.str.1 = [13 x i8] c"Char : 0x%x\0A\00"
@stdin = global i32 0
@.str.2 = [10 x i8] c"0x%02x : \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i8
br label %4
4: ; preds = %2, %64
%5 = phi i32 [ 0, %2 ], [ %65, %64 ]
%6 = add nsw i32 %5, -32
%7 = icmp ult i32 %6, 95
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %5)
br label %12
10: ; preds = %4
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %5)
br label %12
12: ; preds = %10, %8
br label %13
13: ; preds = %12, %18
%14 = phi i32 [ %62, %18 ], [ 0, %12 ]
%15 = load i32, i32* @stdin
%16 = call i32 @fread(i8* %3, i32 1, i32 1, i32 %15)
%17 = icmp slt i32 %16, 1
br i1 %17, label %67, label %18
18: ; preds = %13
%19 = load i8, i8* %3
%20 = zext i8 %19 to i32
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %20)
%22 = load i8, i8* %3
%23 = icmp sgt i8 %22, -1
%24 = select i1 %23, i32 32, i32 35
%25 = call i32 @putchar(i32 %24)
%26 = load i8, i8* %3
%27 = and i8 %26, 64
%28 = icmp eq i8 %27, 0
%29 = select i1 %28, i32 32, i32 35
%30 = call i32 @putchar(i32 %29)
%31 = load i8, i8* %3
%32 = and i8 %31, 32
%33 = icmp eq i8 %32, 0
%34 = select i1 %33, i32 32, i32 35
%35 = call i32 @putchar(i32 %34)
%36 = load i8, i8* %3
%37 = and i8 %36, 16
%38 = icmp eq i8 %37, 0
%39 = select i1 %38, i32 32, i32 35
%40 = call i32 @putchar(i32 %39)
%41 = load i8, i8* %3
%42 = and i8 %41, 8
%43 = icmp eq i8 %42, 0
%44 = select i1 %43, i32 32, i32 35
%45 = call i32 @putchar(i32 %44)
%46 = load i8, i8* %3
%47 = and i8 %46, 4
%48 = icmp eq i8 %47, 0
%49 = select i1 %48, i32 32, i32 35
%50 = call i32 @putchar(i32 %49)
%51 = load i8, i8* %3
%52 = and i8 %51, 2
%53 = icmp eq i8 %52, 0
%54 = select i1 %53, i32 32, i32 35
%55 = call i32 @putchar(i32 %54)
%56 = load i8, i8* %3
%57 = and i8 %56, 1
%58 = icmp eq i8 %57, 0
%59 = select i1 %58, i32 32, i32 35
%60 = call i32 @putchar(i32 %59)
%61 = call i32 @putchar(i32 10)
%62 = add nuw nsw i32 %14, 1
%63 = icmp eq i32 %62, 16
br i1 %63, label %64, label %13
64: ; preds = %18
%65 = add nuw nsw i32 %5, 1
%66 = icmp eq i32 %65, 256
br i1 %66, label %67, label %4
67: ; preds = %64, %13
%68 = phi i32 [ -1, %13 ], [ 0, %64 ]
ret i32 %68
}