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

/* Variables and functions */
int EOF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(int);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int main(int nArgC, char **ppArgV) {
  int bBinary = 0;
  char *pFileName;
  FILE *pFile;
  int nChar;
  char *pArg0 = *ppArgV++;
  nArgC--;
  if (nArgC >= 1 && strcmp(*ppArgV, "-b") == 0) {
    bBinary = 1;
    ppArgV++;
    nArgC--;
  }
  if (nArgC != 1) {
    fprintf(stderr, "\nUsage: %s [-b] file\n\n", pArg0);
    return 1;
  }
  pFileName = *ppArgV++;
  nArgC--;
  pFile = fopen(pFileName, bBinary ? "rb" : "r");
  if (pFile == NULL) {
    fprintf(stderr, "\n%s: File not found: %s\n\n", pArg0, pFileName);
    return 1;
  }
  if (!bBinary) {
    printf("\"");
    while ((nChar = fgetc(pFile)) != EOF) {
      switch (nChar) {
      case '\"':
        printf("\\\"");
        break;
      case '\t':
        printf("\\t");
        break;
      case '\n':
        printf("\\n\"\n\"");
        break;
      case '\r':
        break;
      default:
        putchar(nChar);
        break;
      }
    }
    printf("\"");
  } else {
    unsigned nOffset = 0;
    while ((nChar = fgetc(pFile)) != EOF) {
      printf("0x%02X,%c", nChar, ++nOffset % 16 == 0 ? '\n' : ' ');
    }
    printf("\n");
  }
  fclose(pFile);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jl     11ef <main+0x7f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xea4(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    11ef <main+0x7f>
movl   $0x1,-0x14(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
je     1220 <main+0xb0>
mov    0x2dd8(%rip),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%rdx
lea    0xe5e(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    13c6 <main+0x256>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%ecx
lea    0xe38(%rip),%rsi
lea    0xe2e(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
call   1090 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    129a <main+0x12a>
mov    0x2d62(%rip),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xe00(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    13c6 <main+0x256>
cmpl   $0x0,-0x14(%rbp)
jne    1354 <main+0x1e4>
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1060 <fgetc@plt>
mov    %eax,-0x2c(%rbp)
mov    0x2d23(%rip),%rcx
cmp    (%rcx),%eax
je     1341 <main+0x1d1>
mov    -0x2c(%rbp),%eax
add    $0xfffffff7,%eax
mov    %eax,%ecx
mov    %rcx,-0x48(%rbp)
sub    $0x19,%eax
ja     1334 <main+0x1c4>
mov    -0x48(%rbp),%rax
lea    0xd13(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xda4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    133c <main+0x1cc>
lea    0xd94(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    133c <main+0x1cc>
lea    0xd84(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    133c <main+0x1cc>
jmp    133c <main+0x1cc>
mov    -0x2c(%rbp),%edi
call   1030 <putchar@plt>
jmp    12b2 <main+0x142>
lea    0xd63(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    13b6 <main+0x246>
movl   $0x0,-0x3c(%rbp)
mov    -0x28(%rbp),%rdi
call   1060 <fgetc@plt>
mov    %eax,-0x2c(%rbp)
mov    0x2c7a(%rip),%rcx
cmp    (%rcx),%eax
je     13a8 <main+0x238>
mov    -0x2c(%rbp),%esi
mov    -0x3c(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x3c(%rbp)
and    $0xf,%ecx
mov    $0x20,%edx
mov    $0xa,%eax
cmp    $0x0,%ecx
cmove  %eax,%edx
lea    0xd11(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    135b <main+0x1eb>
lea    0xcd1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    (%rsi),%r14
cmp    $0x2,%edi
jl     1224 <main+0xb4>
mov    %rsi,%rbp
mov    %edi,%ebx
mov    0x8(%rsi),%rdi
lea    0xed1(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x1,%rax
sbb    $0x0,%ebx
cmp    $0x2,%ebx
jne    1224 <main+0xb4>
mov    %rax,%r15
xor    %eax,%eax
test   %r15,%r15
sete   %al
mov    0x8(%rbp,%rax,8),%rbp
lea    0xec3(%rip),%rax
lea    0xebf(%rip),%rsi
cmove  %rax,%rsi
mov    %rbp,%rdi
call   1090 <fopen@plt>
test   %rax,%rax
je     12b9 <main+0x149>
mov    %rax,%r13
test   %r15,%r15
je     12db <main+0x16b>
mov    $0x22,%ebp
mov    $0x22,%edi
call   1030 <putchar@plt>
mov    %r13,%rdi
call   1060 <fgetc@plt>
mov    0x2de3(%rip),%rbx
cmp    (%rbx),%eax
je     1337 <main+0x1c7>
lea    0xdec(%rip),%r14
lea    0xe8c(%rip),%r15
lea    0xe7f(%rip),%r12
jmp    127a <main+0x10a>
mov    0x2dad(%rip),%rax
mov    (%rax),%edi
lea    0xe37(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13,%rdi
call   1060 <fgetc@plt>
cmp    (%rbx),%eax
je     1337 <main+0x1c7>
lea    -0x9(%rax),%ecx
cmp    $0x19,%ecx
ja     12b0 <main+0x140>
movslq (%r14,%rcx,4),%rcx
add    %r14,%rcx
jmp    *%rcx
lea    0xe12(%rip),%rdi
jmp    1263 <main+0xf3>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15,%rdi
jmp    1263 <main+0xf3>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %eax,%edi
call   1030 <putchar@plt>
jmp    126a <main+0xfa>
mov    0x2d18(%rip),%rax
mov    (%rax),%edi
lea    0xdbe(%rip),%rsi
mov    %r14,%rdx
mov    %rbp,%rcx
xor    %eax,%eax
call   1080 <fprintf@plt>
jmp    123e <main+0xce>
mov    %r13,%rdi
call   1060 <fgetc@plt>
mov    0x2cfe(%rip),%r15
mov    $0xa,%ebp
cmp    (%r15),%eax
je     1337 <main+0x1c7>
mov    $0x1,%ebx
lea    0xdad(%rip),%r14
mov    $0xa,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
test   $0xf,%bl
mov    $0x20,%edx
cmove  %ebp,%edx
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13,%rdi
call   1060 <fgetc@plt>
add    $0x1,%ebx
cmp    (%r15),%eax
jne    1310 <main+0x1a0>
mov    %ebp,%edi
call   1030 <putchar@plt>
mov    %r13,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
jmp    1243 <main+0xd3>

LLVM IR (-O0):
@.str = [3 x i8] c"-b\00"
@stderr = global i32 0
@.str.1 = [23 x i8] c"\0AUsage: %s [-b] file\0A\0A\00"
@.str.2 = [3 x i8] c"rb\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [26 x i8] c"\0A%s: File not found: %s\0A\0A\00"
@.str.5 = [2 x i8] c"\22\00"
@EOF = global i32 0
@.str.6 = [3 x i8] c"\\\22\00"
@.str.7 = [3 x i8] c"\\t\00"
@.str.8 = [6 x i8] c"\\n\22\0A\22\00"
@.str.9 = [10 x i8] c"0x%02X,%c\00"
@.str.10 = [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 i8*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i32 1
store i8** %13, i8*** %5
%14 = load i8*, i8** %12
store i8* %14, i8** %10
%15 = load i32, i32* %4
%16 = add nsw i32 %15, -1
store i32 %16, i32* %4
%17 = load i32, i32* %4
%18 = icmp sge i32 %17, 1
br i1 %18, label %19, label %29
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = load i8*, i8** %20
%22 = call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %29
24: ; preds = %19
store i32 1, i32* %6
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i32 1
store i8** %26, i8*** %5
%27 = load i32, i32* %4
%28 = add nsw i32 %27, -1
store i32 %28, i32* %4
br label %29
29: ; preds = %24, %19, %2
%30 = load i32, i32* %4
%31 = icmp ne i32 %30, 1
br i1 %31, label %32, label %36
32: ; preds = %29
%33 = load i32, i32* @stderr
%34 = load i8*, i8** %10
%35 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %34)
store i32 1, i32* %3
br label %100
36: ; preds = %29
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i32 1
store i8** %38, i8*** %5
%39 = load i8*, i8** %37
store i8* %39, i8** %7
%40 = load i32, i32* %4
%41 = add nsw i32 %40, -1
store i32 %41, i32* %4
%42 = load i8*, i8** %7
%43 = load i32, i32* %6
%44 = icmp ne i32 %43, 0
%45 = zext i1 %44 to i64
%46 = select i1 %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0)
%47 = call i32* @fopen(i8* %42, i8* %46)
store i32* %47, i32** %8
%48 = load i32*, i32** %8
%49 = icmp eq i32* %48, null
br i1 %49, label %50, label %55
50: ; preds = %36
%51 = load i32, i32* @stderr
%52 = load i8*, i8** %10
%53 = load i8*, i8** %7
%54 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %51, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* %52, i8* %53)
store i32 1, i32* %3
br label %100
55: ; preds = %36
%56 = load i32, i32* %6
%57 = icmp ne i32 %56, 0
br i1 %57, label %80, label %58
58: ; preds = %55
%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 = %77, %58
%61 = load i32*, i32** %8
%62 = call i32 @fgetc(i32* %61)
store i32 %62, i32* %9
%63 = load i32, i32* @EOF
%64 = icmp ne i32 %62, %63
br i1 %64, label %65, label %78
65: ; preds = %60
%66 = load i32, i32* %9
switch i32 %66, label %74 [
i32 34, label %67
i32 9, label %69
i32 10, label %71
i32 13, label %73
]
67: ; preds = %65
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %77
69: ; preds = %65
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
br label %77
71: ; preds = %65
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
br label %77
73: ; preds = %65
br label %77
74: ; preds = %65
%75 = load i32, i32* %9
%76 = call i32 @putchar(i32 %75)
br label %77
77: ; preds = %74, %73, %71, %69, %67
br label %60
78: ; preds = %60
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %97
80: ; preds = %55
store i32 0, i32* %11
br label %81
81: ; preds = %86, %80
%82 = load i32*, i32** %8
%83 = call i32 @fgetc(i32* %82)
store i32 %83, i32* %9
%84 = load i32, i32* @EOF
%85 = icmp ne i32 %83, %84
br i1 %85, label %86, label %95
86: ; preds = %81
%87 = load i32, i32* %9
%88 = load i32, i32* %11
%89 = add i32 %88, 1
store i32 %89, i32* %11
%90 = urem i32 %89, 16
%91 = icmp eq i32 %90, 0
%92 = zext i1 %91 to i64
%93 = select i1 %91, i32 10, i32 32
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i32 %87, i32 %93)
br label %81
95: ; preds = %81
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
br label %97
97: ; preds = %95, %78
%98 = load i32*, i32** %8
%99 = call i32 @fclose(i32* %98)
store i32 0, i32* %3
br label %100
100: ; preds = %97, %50, %32
%101 = load i32, i32* %3
ret i32 %101
}

LLVM IR (-O2):
@.str = [3 x i8] c"-b\00"
@stderr = global i32 0
@.str.1 = [23 x i8] c"\0AUsage: %s [-b] file\0A\0A\00"
@.str.2 = [3 x i8] c"rb\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [26 x i8] c"\0A%s: File not found: %s\0A\0A\00"
@EOF = global i32 0
@.str.6 = [3 x i8] c"\\\22\00"
@.str.7 = [3 x i8] c"\\t\00"
@.str.8 = [6 x i8] c"\\n\22\0A\22\00"
@.str.9 = [10 x i8] c"0x%02X,%c\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %1
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %13
6: ; preds = %2
%7 = load i8*, i8** %3
%8 = tail call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
%10 = select i1 %9, i32 -2, i32 -1
%11 = add nsw i32 %10, %0
%12 = icmp eq i32 %11, 1
br i1 %12, label %16, label %13
13: ; preds = %2, %6
%14 = load i32, i32* @stderr
%15 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %4)
br label %65
16: ; preds = %6
%17 = getelementptr inbounds i8*, i8** %1, i64 2
%18 = select i1 %9, i8** %17, i8** %3
%19 = load i8*, i8** %18
%20 = select i1 %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0)
%21 = tail call i32* @fopen(i8* %19, i8* %20)
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %26
23: ; preds = %16
%24 = load i32, i32* @stderr
%25 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* %4, i8* %19)
br label %65
26: ; preds = %16
br i1 %9, label %27, label %31
27: ; preds = %26
%28 = tail call i32 @fgetc(i32* %21)
%29 = load i32, i32* @EOF
%30 = icmp eq i32 %28, %29
br i1 %30, label %61, label %50
31: ; preds = %26
%32 = tail call i32 @putchar(i32 34)
%33 = tail call i32 @fgetc(i32* %21)
%34 = load i32, i32* @EOF
%35 = icmp eq i32 %33, %34
br i1 %35, label %61, label %36
36: ; preds = %31, %46
%37 = phi i32 [ %47, %46 ], [ %33, %31 ]
switch i32 %37, label %44 [
i32 34, label %38
i32 9, label %40
i32 10, label %42
i32 13, label %46
]
38: ; preds = %36
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %46
40: ; preds = %36
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
br label %46
42: ; preds = %36
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
br label %46
44: ; preds = %36
%45 = tail call i32 @putchar(i32 %37)
br label %46
46: ; preds = %44, %36, %42, %40, %38
%47 = tail call i32 @fgetc(i32* %21)
%48 = load i32, i32* @EOF
%49 = icmp eq i32 %47, %48
br i1 %49, label %61, label %36
50: ; preds = %27, %50
%51 = phi i32 [ %58, %50 ], [ %28, %27 ]
%52 = phi i32 [ %53, %50 ], [ 0, %27 ]
%53 = add i32 %52, 1
%54 = and i32 %53, 15
%55 = icmp eq i32 %54, 0
%56 = select i1 %55, i32 10, i32 32
%57 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i32 %51, i32 %56)
%58 = tail call i32 @fgetc(i32* %21)
%59 = load i32, i32* @EOF
%60 = icmp eq i32 %58, %59
br i1 %60, label %61, label %50
61: ; preds = %46, %50, %27, %31
%62 = phi i32 [ 34, %31 ], [ 10, %27 ], [ 10, %50 ], [ 34, %46 ]
%63 = tail call i32 @putchar(i32 %62)
%64 = tail call i32 @fclose(i32* %21)
br label %65
65: ; preds = %61, %23, %13
%66 = phi i32 [ 1, %13 ], [ 1, %23 ], [ 0, %61 ]
ret i32 %66
}