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

/* Variables and functions */
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int main(void) {
  char buf[4096];
  int x;
  while (fgets(buf, sizeof(buf) - 2, stdin) != NULL) {
    for (x = 0; x < 128;) {
      printf("0x%c%c, ", buf[x], buf[x + 1]);
      if (!((x += 2) & 31))
        printf("\n");
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1020,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x1010(%rbp),%rdi
mov    0x2ea8(%rip),%rax
mov    (%rax),%edx
mov    $0xffe,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     11d3 <main+0xb3>
movl   $0x0,-0x1014(%rbp)
cmpl   $0x80,-0x1014(%rbp)
jge    11ce <main+0xae>
movslq -0x1014(%rbp),%rax
movsbl -0x1010(%rbp,%rax,1),%esi
ff
mov    -0x1014(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x1010(%rbp,%rax,1),%edx
ff
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1014(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x1014(%rbp)
and    $0x1f,%eax
cmp    $0x0,%eax
jne    11c9 <main+0xa9>
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1160 <main+0x40>
jmp    1132 <main+0x12>
mov    -0x4(%rbp),%eax
add    $0x1020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1000,%rsp
mov    0x2ea1(%rip),%r15
mov    (%r15),%edx
mov    %rsp,%rdi
mov    $0xffe,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     11ca <main+0x9a>
lea    0xe9d(%rip),%r12
mov    %rsp,%r14
xor    %ebx,%ebx
jmp    1179 <main+0x49>
nopw   0x0(%rax,%rax,1)
cmp    $0x7e,%rbx
mov    %r13,%rbx
jae    11b0 <main+0x80>
movsbl (%rsp,%rbx,1),%esi
mov    %rbx,%rax
or     $0x1,%rax
movsbl (%rsp,%rax,1),%edx
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x2(%rbx),%r13
test   $0x1e,%r13b
jne    1170 <main+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1170 <main+0x40>
nopl   0x0(%rax,%rax,1)
mov    (%r15),%edx
mov    %r14,%rdi
mov    $0xffe,%esi
call   1050 <fgets@plt>
mov    $0x0,%ebx
test   %rax,%rax
jne    1179 <main+0x49>
xor    %eax,%eax
add    $0x1000,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [9 x i8] c"0x%c%c, \00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4096 x i8]
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %33, %0
%5 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%6 = load i32, i32* @stdin
%7 = call i32* @fgets(i8* %5, i32 4094, i32 %6)
%8 = icmp ne i32* %7, null
br i1 %8, label %9, label %34
9: ; preds = %4
store i32 0, i32* %3
br label %10
10: ; preds = %32, %9
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, 128
br i1 %12, label %13, label %33
13: ; preds = %10
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %18, i32 %24)
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 2
store i32 %27, i32* %3
%28 = and i32 %27, 31
%29 = icmp ne i32 %28, 0
br i1 %29, label %32, label %30
30: ; preds = %13
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %32
32: ; preds = %30, %13
br label %10
33: ; preds = %10
br label %4
34: ; preds = %4
%35 = load i32, i32* %1
ret i32 %35
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [9 x i8] c"0x%c%c, \00"
define i32 @main() {
%1 = alloca [4096 x i8]
%2 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i32* @fgets(i8* %2, i32 4094, i32 %3)
%5 = icmp eq i32* %4, null
br i1 %5, label %29, label %10
6: ; preds = %25
%7 = load i32, i32* @stdin
%8 = call i32* @fgets(i8* %2, i32 4094, i32 %7)
%9 = icmp eq i32* %8, null
br i1 %9, label %29, label %27
10: ; preds = %0, %27
%11 = phi i64 [ %28, %27 ], [ 0, %0 ]
%12 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = or i64 %11, 1
%16 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %18)
%20 = add nuw nsw i64 %11, 2
%21 = and i64 %20, 30
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %10
%24 = call i32 @putchar(i32 10)
br label %25
25: ; preds = %23, %10
%26 = icmp ult i64 %11, 126
br i1 %26, label %27, label %6
27: ; preds = %25, %6
%28 = phi i64 [ %20, %25 ], [ 0, %6 ]
br label %10
29: ; preds = %6, %0
ret i32 0
}