#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*/ c;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ *stdin;
int main(int argc, char **argv) {
  FILE *infp = stdin;
  char c;
  int column = 0;
  int start = 1;
  while (!feof(infp)) {
    int err;
    err = fread(&c, sizeof(c), 1, infp);
    if (err != 1)
      break;
    if ((column % 16) == 0) {
      if (!start) {
        printf("\n");
      } else {
        start = 0;
      }
      printf(".byte\t");
    } else {
      printf(",");
    }
    printf("0x%02x", ((int)c) & 0xff);
    column++;
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e9b(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1180 <main+0x50>
jmp    1225 <main+0xf5>
mov    -0x18(%rbp),%rcx
lea    -0x19(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x1,-0x28(%rbp)
je     11a6 <main+0x76>
jmp    1225 <main+0xf5>
mov    -0x20(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11f1 <main+0xc1>
cmpl   $0x0,-0x24(%rbp)
jne    11d7 <main+0xa7>
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11de <main+0xae>
movl   $0x0,-0x24(%rbp)
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11ff <main+0xcf>
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsbl -0x19(%rbp),%esi
and    $0xff,%esi
lea    0xdfb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1162 <main+0x32>
lea    0xdd4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x2e96(%rip),%rax
mov    (%rax),%rbx
mov    %rbx,%rdi
call   1060 <feof@plt>
test   %eax,%eax
je     117c <main+0x3c>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%r13d
lea    0x7(%rsp),%r14
lea    0xe72(%rip),%r15
lea    0xe72(%rip),%r12
xor    %ebp,%ebp
jmp    11c8 <main+0x88>
nopl   0x0(%rax)
mov    $0x2c,%edi
call   1030 <putchar@plt>
movzbl 0x7(%rsp),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%ebp
mov    %rbx,%rdi
call   1060 <feof@plt>
test   %eax,%eax
jne    1161 <main+0x21>
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fread@plt>
cmp    $0x1,%eax
jne    1161 <main+0x21>
test   $0xf,%bpl
jne    11a0 <main+0x60>
test   %r13d,%r13d
jne    11fb <main+0xbb>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %r13d,%r13d
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11aa <main+0x6a>

LLVM IR (-O0):
@stdin = global i32* null
@.str = [2 x i8] c"\0A\00"
@.str.1 = [7 x i8] c".byte\09\00"
@.str.2 = [2 x i8] c",\00"
@.str.3 = [7 x i8] c"0x%02x\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i8
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32*, i32** @stdin
store i32* %11, i32** %6
store i32 0, i32* %8
store i32 1, i32* %9
br label %12
12: ; preds = %37, %2
%13 = load i32*, i32** %6
%14 = call i32 @feof(i32* %13)
%15 = icmp ne i32 %14, 0
%16 = xor i1 %15, true
br i1 %16, label %17, label %44
17: ; preds = %12
%18 = load i32*, i32** %6
%19 = call i32 @fread(i8* %7, i32 1, i32 1, i32* %18)
store i32 %19, i32* %10
%20 = load i32, i32* %10
%21 = icmp ne i32 %20, 1
br i1 %21, label %22, label %23
22: ; preds = %17
br label %44
23: ; preds = %17
%24 = load i32, i32* %8
%25 = srem i32 %24, 16
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %35
27: ; preds = %23
%28 = load i32, i32* %9
%29 = icmp ne i32 %28, 0
br i1 %29, label %32, label %30
30: ; preds = %27
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %33
32: ; preds = %27
store i32 0, i32* %9
br label %33
33: ; preds = %32, %30
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %37
35: ; preds = %23
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %37
37: ; preds = %35, %33
%38 = load i8, i8* %7
%39 = sext i8 %38 to i32
%40 = and i32 %39, 255
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %40)
%42 = load i32, i32* %8
%43 = add nsw i32 %42, 1
store i32 %43, i32* %8
br label %12
44: ; preds = %22, %12
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

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