#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 EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ SEEK_END;
int fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
size_t fread(unsigned char *, int, size_t, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(unsigned char *);
int fseek(int /*<<< orphan*/ *, int /*<<< orphan*/, int /*<<< orphan*/);
size_t ftell(int /*<<< orphan*/ *);
unsigned char *malloc(size_t);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  FILE *file;
  int ret;
  unsigned char *buf;
  size_t count, i, j;
  if (argc != 2) {
    printf("Usage:\n%s FILENAME\n", argv[0]);
    return EXIT_FAILURE;
  }
  file = fopen(argv[1], "r");
  if (!file) {
    perror("fopen");
    return EXIT_FAILURE;
  }
  ret = fseek(file, 0, SEEK_END);
  if (ret < 0) {
    perror("fseek");
    return EXIT_FAILURE;
  }
  count = ftell(file);
  if (!count) {
    fprintf(stderr, "File %s has length 0\n", argv[1]);
    return EXIT_FAILURE;
  }
  rewind(file);
  buf = malloc(count);
  if (!buf) {
    perror("calloc");
    return EXIT_FAILURE;
  }
  count = fread(buf, 1, count, file);
  printf("/* SPDX-License-Identifier: GPL-2.0+ */\n");
  printf("/*\n");
  printf(" *  Non-zero %u byte strings of a disk image\n", 8);
  printf(" *\n");
  printf(" *  Generated with tools/file2include\n");
  printf(" */\n\n");
  printf("#define EFI_ST_DISK_IMG { 0x%08zx, { \\\n", count);
  for (i = 0; i < count; i += 8) {
    int c = 0;
    for (j = i; j < i + 8 && j < count; ++j) {
      if (buf[j])
        c = 1;
    }
    if (!c)
      continue;
    printf("\t{0x%08zx, \"", i);
    for (j = i; j < i + 8 && j < count; ++j)
      printf("\\x%02x", buf[j]);
    printf("\"}, /* ");
    for (j = i; j < i + 8 && j < count; ++j) {
      if (buf[j] != '*' && buf[j] >= 0x20 && buf[j] <= 0x7e)
        printf("%c", buf[j]);
      else
        printf(".");
    }
    printf(" */ \\\n");
  }
  printf("\t{0, NULL} } }\n");
  free(buf);
  ret = fclose(file);
  if (ret) {
    perror("fclose");
    return EXIT_FAILURE;
  }
  return EXIT_SUCCESS;
}


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)
cmpl   $0x2,-0x8(%rbp)
je     11f6 <main+0x46>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0x2de4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    15da <main+0x42a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe0f(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1236 <main+0x86>
lea    0xdf6(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2da4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    15da <main+0x42a>
mov    -0x18(%rbp),%rdi
mov    0x2da7(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10b0 <fseek@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    1274 <main+0xc4>
lea    0xdbe(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2d66(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    15da <main+0x42a>
mov    -0x18(%rbp),%rdi
call   1090 <ftell@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    12ba <main+0x10a>
mov    0x2d45(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xd7e(%rip),%rsi
call   1080 <fprintf@plt>
mov    0x2d20(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    15da <main+0x42a>
mov    -0x18(%rbp),%rdi
call   1070 <rewind@plt>
mov    -0x30(%rbp),%rdi
call   10a0 <malloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    12f8 <main+0x148>
lea    0xd56(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2ce2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    15da <main+0x42a>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fread@plt>
mov    %rax,-0x30(%rbp)
lea    0xd26(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd41(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd37(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd52(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd48(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd61(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x30(%rbp),%rsi
lea    0xd55(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x30(%rbp),%rax
jae    1584 <main+0x3d4>
movl   $0x0,-0x44(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rcx
mov    -0x38(%rbp),%rdx
add    $0x8,%rdx
xor    %eax,%eax
cmp    %rdx,%rcx
mov    %al,-0x45(%rbp)
jae    13ca <main+0x21a>
mov    -0x40(%rbp),%rax
cmp    -0x30(%rbp),%rax
setb   %al
mov    %al,-0x45(%rbp)
mov    -0x45(%rbp),%al
test   $0x1,%al
jne    13da <main+0x22a>
jmp    1409 <main+0x259>
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     13f3 <main+0x243>
movl   $0x1,-0x44(%rbp)
jmp    13f8 <main+0x248>
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    13a2 <main+0x1f2>
cmpl   $0x0,-0x44(%rbp)
jne    1418 <main+0x268>
jmp    1573 <main+0x3c3>
mov    -0x38(%rbp),%rsi
lea    0xcd0(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x38(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rcx
mov    -0x38(%rbp),%rdx
add    $0x8,%rdx
xor    %eax,%eax
cmp    %rdx,%rcx
mov    %al,-0x46(%rbp)
jae    145a <main+0x2aa>
mov    -0x40(%rbp),%rax
cmp    -0x30(%rbp),%rax
setb   %al
mov    %al,-0x46(%rbp)
mov    -0x46(%rbp),%al
test   $0x1,%al
jne    146a <main+0x2ba>
jmp    1495 <main+0x2e5>
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xc83(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    1432 <main+0x282>
lea    0xc6b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x38(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rcx
mov    -0x38(%rbp),%rdx
add    $0x8,%rdx
xor    %eax,%eax
cmp    %rdx,%rcx
mov    %al,-0x47(%rbp)
jae    14d3 <main+0x323>
mov    -0x40(%rbp),%rax
cmp    -0x30(%rbp),%rax
setb   %al
mov    %al,-0x47(%rbp)
mov    -0x47(%rbp),%al
test   $0x1,%al
jne    14e3 <main+0x333>
jmp    1565 <main+0x3b5>
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x2a,%eax
je     1541 <main+0x391>
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jl     1541 <main+0x391>
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x7e,%eax
jg     1541 <main+0x391>
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xbda(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    154f <main+0x39f>
lea    0xbca(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1554 <main+0x3a4>
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    14ab <main+0x2fb>
lea    0xba8(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x38(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x38(%rbp)
jmp    1385 <main+0x1d5>
lea    0xb90(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     15ce <main+0x41e>
lea    0xb73(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2a0c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    15da <main+0x42a>
mov    0x29f3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-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
sub    $0x18,%rsp
mov    %rsi,%rbx
cmp    $0x2,%edi
jne    14b9 <main+0x2e9>
mov    0x8(%rbx),%rdi
lea    0xe1f(%rip),%rsi
call   10e0 <fopen@plt>
test   %rax,%rax
je     1512 <main+0x342>
mov    %rax,%rbp
mov    0x2ddb(%rip),%rax
mov    (%rax),%edx
mov    %rbp,%rdi
xor    %esi,%esi
call   10d0 <fseek@plt>
test   %eax,%eax
js     151b <main+0x34b>
mov    %rbp,%rdi
call   10b0 <ftell@plt>
test   %rax,%rax
je     14f7 <main+0x327>
mov    %rax,%r14
mov    %rbp,%rdi
call   1090 <rewind@plt>
mov    %r14,%rdi
call   10c0 <malloc@plt>
test   %rax,%rax
je     1524 <main+0x354>
mov    %rax,%r15
mov    %rax,%rdi
mov    $0x1,%esi
mov    %r14,%rdx
mov    %rbp,0x10(%rsp)
mov    %rbp,%rcx
call   1060 <fread@plt>
mov    %rax,%r12
lea    0xe45(%rip),%rdi
call   1050 <puts@plt>
lea    0xe61(%rip),%rdi
call   1050 <puts@plt>
lea    0xdb4(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xe45(%rip),%rdi
call   1050 <puts@plt>
lea    0xe3c(%rip),%rdi
call   1050 <puts@plt>
lea    0xe56(%rip),%rdi
call   1050 <puts@plt>
lea    0xdab(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
test   %r12,%r12
je     14cc <main+0x2fc>
mov    $0x1,%r14d
xor    %r13d,%r13d
jmp    130c <main+0x13c>
lea    0xdc2(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x8(%rsp),%r14
lea    0xe26(%rip),%rdi
call   1050 <puts@plt>
add    $0x8,%r14
cmp    %r12,%r13
jae    14cc <main+0x2fc>
mov    %r13,%rbx
add    $0x8,%r13
cmp    $0xfffffffffffffff8,%rbx
je     12ff <main+0x12f>
xor    %eax,%eax
cmpb   $0x0,(%r15,%rbx,1)
setne  %al
mov    %rbx,%rcx
or     $0x1,%rcx
cmp    %r13,%rcx
jae    1410 <main+0x240>
cmp    %r12,%rcx
jae    1410 <main+0x240>
cmpb   $0x0,(%r15,%rcx,1)
mov    $0x1,%ecx
cmovne %ecx,%eax
mov    %rbx,%rcx
or     $0x2,%rcx
cmp    %r13,%rcx
jae    1410 <main+0x240>
cmp    %r12,%rcx
jae    1410 <main+0x240>
cmpb   $0x0,(%r15,%rcx,1)
mov    $0x1,%ecx
cmovne %ecx,%eax
mov    %rbx,%rcx
or     $0x3,%rcx
cmp    %r13,%rcx
jae    1410 <main+0x240>
cmp    %r12,%rcx
jae    1410 <main+0x240>
cmpb   $0x0,(%r15,%rcx,1)
mov    $0x1,%ecx
cmovne %ecx,%eax
mov    %rbx,%rcx
or     $0x4,%rcx
cmp    %r13,%rcx
jae    1410 <main+0x240>
cmp    %r12,%rcx
jae    1410 <main+0x240>
cmpb   $0x0,(%r15,%rcx,1)
mov    $0x1,%ecx
cmovne %ecx,%eax
mov    %rbx,%rcx
or     $0x5,%rcx
cmp    %r13,%rcx
jae    1410 <main+0x240>
cmp    %r12,%rcx
jae    1410 <main+0x240>
cmpb   $0x0,(%r15,%rcx,1)
mov    $0x1,%ecx
cmovne %ecx,%eax
mov    %rbx,%rcx
or     $0x6,%rcx
cmp    %r13,%rcx
jae    1410 <main+0x240>
cmp    %r12,%rcx
jae    1410 <main+0x240>
cmpb   $0x0,(%r15,%rcx,1)
mov    $0x1,%ecx
cmovne %ecx,%eax
mov    %rbx,%rcx
or     $0x7,%rcx
cmp    %r13,%rcx
jae    1410 <main+0x240>
cmp    %r12,%rcx
jae    1410 <main+0x240>
cmpb   $0x0,(%r15,%rcx,1)
mov    $0x1,%ecx
cmovne %ecx,%eax
nopl   (%rax)
test   %eax,%eax
je     12ff <main+0x12f>
lea    0xc76(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r14,0x8(%rsp)
cmp    $0xfffffffffffffff8,%rbx
lea    0xc69(%rip),%rbx
je     12e0 <main+0x110>
nop
movzbl -0x1(%r15,%r14,1),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
cmp    %r13,%r14
jae    1461 <main+0x291>
lea    0x1(%r14),%rax
cmp    %r12,%r14
mov    %rax,%r14
jb     1440 <main+0x270>
lea    0xc41(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x8(%rsp),%r14
mov    %r14,%rbp
mov    $0x2e,%ebx
nopl   0x0(%rax)
movzbl -0x1(%r15,%rbp,1),%eax
lea    -0x20(%rax),%ecx
cmp    $0x5f,%cl
mov    $0x2e,%edi
cmovb  %eax,%edi
cmp    $0x2a,%eax
cmove  %ebx,%edi
call   1040 <putchar@plt>
cmp    %r13,%rbp
jae    12f3 <main+0x123>
lea    0x1(%rbp),%rax
cmp    %r12,%rbp
mov    %rax,%rbp
jb     1480 <main+0x2b0>
jmp    12f3 <main+0x123>
mov    (%rbx),%rsi
lea    0xb3d(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
jmp    1539 <main+0x369>
lea    0xc3e(%rip),%rdi
call   1050 <puts@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    0x10(%rsp),%rdi
call   1070 <fclose@plt>
test   %eax,%eax
jne    152d <main+0x35d>
mov    0x2ad3(%rip),%rax
jmp    1540 <main+0x370>
mov    0x2ada(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xb17(%rip),%rsi
call   10a0 <fprintf@plt>
jmp    1539 <main+0x369>
lea    0xafd(%rip),%rdi
jmp    1534 <main+0x364>
lea    0xafa(%rip),%rdi
jmp    1534 <main+0x364>
lea    0xb0d(%rip),%rdi
jmp    1534 <main+0x364>
lea    0xb7d(%rip),%rdi
call   10f0 <perror@plt>
mov    0x2a90(%rip),%rax
mov    (%rax),%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Usage:\0A%s FILENAME\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [6 x i8] c"fopen\00"
@SEEK_END = global i32 0
@.str.3 = [6 x i8] c"fseek\00"
@stderr = global i32 0
@.str.4 = [22 x i8] c"File %s has length 0\0A\00"
@.str.5 = [7 x i8] c"calloc\00"
@.str.6 = [41 x i8] c"/* SPDX-License-Identifier: GPL-2.0+ */\0A\00"
@.str.7 = [4 x i8] c"/*\0A\00"
@.str.8 = [46 x i8] c" * Non-zero %u byte strings of a disk image\0A\00"
@.str.9 = [4 x i8] c" *\0A\00"
@.str.10 = [39 x i8] c" * Generated with tools/file2include\0A\00"
@.str.11 = [6 x i8] c" */\0A\0A\00"
@.str.12 = [40 x i8] c"#define EFI_ST_DISK_IMG { 0x%08zx, { \\\0A\00"
@.str.13 = [13 x i8] c"\09{0x%08zx, \22\00"
@.str.14 = [7 x i8] c"\\x%02x\00"
@.str.15 = [8 x i8] c"\22}, /* \00"
@.str.16 = [3 x i8] c"%c\00"
@.str.17 = [2 x i8] c".\00"
@.str.18 = [7 x i8] c" */ \\\0A\00"
@.str.19 = [16 x i8] c"\09{0, NULL} } }\0A\00"
@.str.20 = [7 x i8] c"fclose\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 2
br i1 %14, label %15, label %21
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %18)
%20 = load i32, i32* @EXIT_FAILURE
store i32 %20, i32* %3
br label %198
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i32* @fopen(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %25, i32** %6
%26 = load i32*, i32** %6
%27 = icmp ne i32* %26, null
br i1 %27, label %31, label %28
28: ; preds = %21
%29 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%30 = load i32, i32* @EXIT_FAILURE
store i32 %30, i32* %3
br label %198
31: ; preds = %21
%32 = load i32*, i32** %6
%33 = load i32, i32* @SEEK_END
%34 = call i32 @fseek(i32* %32, i32 0, i32 %33)
store i32 %34, i32* %7
%35 = load i32, i32* %7
%36 = icmp slt i32 %35, 0
br i1 %36, label %37, label %40
37: ; preds = %31
%38 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%39 = load i32, i32* @EXIT_FAILURE
store i32 %39, i32* %3
br label %198
40: ; preds = %31
%41 = load i32*, i32** %6
%42 = call i64 @ftell(i32* %41)
store i64 %42, i64* %9
%43 = load i64, i64* %9
%44 = icmp ne i64 %43, 0
br i1 %44, label %52, label %45
45: ; preds = %40
%46 = load i32, i32* @stderr
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 1
%49 = load i8*, i8** %48
%50 = call i32 @fprintf(i32 %46, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %49)
%51 = load i32, i32* @EXIT_FAILURE
store i32 %51, i32* %3
br label %198
52: ; preds = %40
%53 = load i32*, i32** %6
%54 = call i32 @rewind(i32* %53)
%55 = load i64, i64* %9
%56 = call i8* @malloc(i64 %55)
store i8* %56, i8** %8
%57 = load i8*, i8** %8
%58 = icmp ne i8* %57, null
br i1 %58, label %62, label %59
59: ; preds = %52
%60 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%61 = load i32, i32* @EXIT_FAILURE
store i32 %61, i32* %3
br label %198
62: ; preds = %52
%63 = load i8*, i8** %8
%64 = load i64, i64* %9
%65 = load i32*, i32** %6
%66 = call i64 @fread(i8* %63, i32 1, i64 %64, i32* %65)
store i64 %66, i64* %9
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0))
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.8, i64 0, i64 0), i32 8)
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.10, i64 0, i64 0))
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0))
%73 = load i64, i64* %9
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.12, i64 0, i64 0), i64 %73)
store i64 0, i64* %10
br label %75
75: ; preds = %182, %62
%76 = load i64, i64* %10
%77 = load i64, i64* %9
%78 = icmp ult i64 %76, %77
br i1 %78, label %79, label %185
79: ; preds = %75
store i32 0, i32* %12
%80 = load i64, i64* %10
store i64 %80, i64* %11
br label %81
81: ; preds = %100, %79
%82 = load i64, i64* %11
%83 = load i64, i64* %10
%84 = add i64 %83, 8
%85 = icmp ult i64 %82, %84
br i1 %85, label %86, label %90
86: ; preds = %81
%87 = load i64, i64* %11
%88 = load i64, i64* %9
%89 = icmp ult i64 %87, %88
br label %90
90: ; preds = %86, %81
%91 = phi i1 [ false, %81 ], [ %89, %86 ]
br i1 %91, label %92, label %103
92: ; preds = %90
%93 = load i8*, i8** %8
%94 = load i64, i64* %11
%95 = getelementptr inbounds i8, i8* %93, i64 %94
%96 = load i8, i8* %95
%97 = icmp ne i8 %96, 0
br i1 %97, label %98, label %99
98: ; preds = %92
store i32 1, i32* %12
br label %99
99: ; preds = %98, %92
br label %100
100: ; preds = %99
%101 = load i64, i64* %11
%102 = add i64 %101, 1
store i64 %102, i64* %11
br label %81
103: ; preds = %90
%104 = load i32, i32* %12
%105 = icmp ne i32 %104, 0
br i1 %105, label %107, label %106
106: ; preds = %103
br label %182
107: ; preds = %103
%108 = load i64, i64* %10
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), i64 %108)
%110 = load i64, i64* %10
store i64 %110, i64* %11
br label %111
111: ; preds = %129, %107
%112 = load i64, i64* %11
%113 = load i64, i64* %10
%114 = add i64 %113, 8
%115 = icmp ult i64 %112, %114
br i1 %115, label %116, label %120
116: ; preds = %111
%117 = load i64, i64* %11
%118 = load i64, i64* %9
%119 = icmp ult i64 %117, %118
br label %120
120: ; preds = %116, %111
%121 = phi i1 [ false, %111 ], [ %119, %116 ]
br i1 %121, label %122, label %132
122: ; preds = %120
%123 = load i8*, i8** %8
%124 = load i64, i64* %11
%125 = getelementptr inbounds i8, i8* %123, i64 %124
%126 = load i8, i8* %125
%127 = zext i8 %126 to i32
%128 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0), i32 %127)
br label %129
129: ; preds = %122
%130 = load i64, i64* %11
%131 = add i64 %130, 1
store i64 %131, i64* %11
br label %111
132: ; preds = %120
%133 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0))
%134 = load i64, i64* %10
store i64 %134, i64* %11
br label %135
135: ; preds = %177, %132
%136 = load i64, i64* %11
%137 = load i64, i64* %10
%138 = add i64 %137, 8
%139 = icmp ult i64 %136, %138
br i1 %139, label %140, label %144
140: ; preds = %135
%141 = load i64, i64* %11
%142 = load i64, i64* %9
%143 = icmp ult i64 %141, %142
br label %144
144: ; preds = %140, %135
%145 = phi i1 [ false, %135 ], [ %143, %140 ]
br i1 %145, label %146, label %180
146: ; preds = %144
%147 = load i8*, i8** %8
%148 = load i64, i64* %11
%149 = getelementptr inbounds i8, i8* %147, i64 %148
%150 = load i8, i8* %149
%151 = zext i8 %150 to i32
%152 = icmp ne i32 %151, 42
br i1 %152, label %153, label %174
153: ; preds = %146
%154 = load i8*, i8** %8
%155 = load i64, i64* %11
%156 = getelementptr inbounds i8, i8* %154, i64 %155
%157 = load i8, i8* %156
%158 = zext i8 %157 to i32
%159 = icmp sge i32 %158, 32
br i1 %159, label %160, label %174
160: ; preds = %153
%161 = load i8*, i8** %8
%162 = load i64, i64* %11
%163 = getelementptr inbounds i8, i8* %161, i64 %162
%164 = load i8, i8* %163
%165 = zext i8 %164 to i32
%166 = icmp sle i32 %165, 126
br i1 %166, label %167, label %174
167: ; preds = %160
%168 = load i8*, i8** %8
%169 = load i64, i64* %11
%170 = getelementptr inbounds i8, i8* %168, i64 %169
%171 = load i8, i8* %170
%172 = zext i8 %171 to i32
%173 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i64 0, i64 0), i32 %172)
br label %176
174: ; preds = %160, %153, %146
%175 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.17, i64 0, i64 0))
br label %176
176: ; preds = %174, %167
br label %177
177: ; preds = %176
%178 = load i64, i64* %11
%179 = add i64 %178, 1
store i64 %179, i64* %11
br label %135
180: ; preds = %144
%181 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.18, i64 0, i64 0))
br label %182
182: ; preds = %180, %106
%183 = load i64, i64* %10
%184 = add i64 %183, 8
store i64 %184, i64* %10
br label %75
185: ; preds = %75
%186 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.19, i64 0, i64 0))
%187 = load i8*, i8** %8
%188 = call i32 @free(i8* %187)
%189 = load i32*, i32** %6
%190 = call i32 @fclose(i32* %189)
store i32 %190, i32* %7
%191 = load i32, i32* %7
%192 = icmp ne i32 %191, 0
br i1 %192, label %193, label %196
193: ; preds = %185
%194 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.20, i64 0, i64 0))
%195 = load i32, i32* @EXIT_FAILURE
store i32 %195, i32* %3
br label %198
196: ; preds = %185
%197 = load i32, i32* @EXIT_SUCCESS
store i32 %197, i32* %3
br label %198
198: ; preds = %196, %193, %59, %45, %37, %28, %15
%199 = load i32, i32* %3
ret i32 %199
}

LLVM IR (-O2):
@.str = [20 x i8] c"Usage:\0A%s FILENAME\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [6 x i8] c"fopen\00"
@SEEK_END = global i32 0
@.str.3 = [6 x i8] c"fseek\00"
@stderr = global i32 0
@.str.4 = [22 x i8] c"File %s has length 0\0A\00"
@.str.5 = [7 x i8] c"calloc\00"
@.str.8 = [46 x i8] c" * Non-zero %u byte strings of a disk image\0A\00"
@.str.12 = [40 x i8] c"#define EFI_ST_DISK_IMG { 0x%08zx, { \\\0A\00"
@.str.13 = [13 x i8] c"\09{0x%08zx, \22\00"
@.str.14 = [7 x i8] c"\\x%02x\00"
@.str.15 = [8 x i8] c"\22}, /* \00"
@.str.20 = [7 x i8] c"fclose\00"
@EXIT_SUCCESS = global i32 0
@str = [40 x i8] c"/* SPDX-License-Identifier: GPL-2.0+ */\00"
@str.21 = [3 x i8] c"/*\00"
@str.22 = [3 x i8] c" *\00"
@str.23 = [38 x i8] c" * Generated with tools/file2include\00"
@str.24 = [5 x i8] c" */\0A\00"
@str.25 = [15 x i8] c"\09{0, NULL} } }\00"
@str.26 = [6 x i8] c" */ \\\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %160
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32* @fopen(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %160
14: ; preds = %7
%15 = load i32, i32* @SEEK_END
%16 = tail call i32 @fseek(i32* %10, i32 0, i32 %15)
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %160
20: ; preds = %14
%21 = tail call i64 @ftell(i32* %10)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %27
23: ; preds = %20
%24 = load i32, i32* @stderr
%25 = load i8*, i8** %8
%26 = tail call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %25)
br label %160
27: ; preds = %20
%28 = tail call i32 @rewind(i32* %10)
%29 = tail call i8* @malloc(i64 %21)
%30 = icmp eq i8* %29, null
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
br label %160
33: ; preds = %27
%34 = tail call i64 @fread(i8* %29, i32 1, i64 %21, i32* %10)
%35 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
%36 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.21, i64 0, i64 0))
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.8, i64 0, i64 0), i32 8)
%38 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.22, i64 0, i64 0))
%39 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.23, i64 0, i64 0))
%40 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.24, i64 0, i64 0))
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.12, i64 0, i64 0), i64 %34)
%42 = icmp eq i64 %34, 0
br i1 %42, label %153, label %43
43: ; preds = %33, %151
%44 = phi i64 [ %45, %151 ], [ 0, %33 ]
%45 = add i64 %44, 8
%46 = icmp eq i64 %44, -8
br i1 %46, label %151, label %47
47: ; preds = %43
%48 = getelementptr inbounds i8, i8* %29, i64 %44
%49 = load i8, i8* %48
%50 = icmp ne i8 %49, 0
%51 = zext i1 %50 to i32
%52 = or i64 %44, 1
%53 = icmp ult i64 %52, %45
%54 = icmp ult i64 %52, %34
%55 = and i1 %53, %54
br i1 %55, label %56, label %115
56: ; preds = %47
%57 = getelementptr inbounds i8, i8* %29, i64 %52
%58 = load i8, i8* %57
%59 = icmp eq i8 %58, 0
%60 = select i1 %59, i32 %51, i32 1
%61 = or i64 %44, 2
%62 = icmp ult i64 %61, %45
%63 = icmp ult i64 %61, %34
%64 = and i1 %62, %63
br i1 %64, label %65, label %115
65: ; preds = %56
%66 = getelementptr inbounds i8, i8* %29, i64 %61
%67 = load i8, i8* %66
%68 = icmp eq i8 %67, 0
%69 = select i1 %68, i32 %60, i32 1
%70 = or i64 %44, 3
%71 = icmp ult i64 %70, %45
%72 = icmp ult i64 %70, %34
%73 = and i1 %71, %72
br i1 %73, label %74, label %115
74: ; preds = %65
%75 = getelementptr inbounds i8, i8* %29, i64 %70
%76 = load i8, i8* %75
%77 = icmp eq i8 %76, 0
%78 = select i1 %77, i32 %69, i32 1
%79 = or i64 %44, 4
%80 = icmp ult i64 %79, %45
%81 = icmp ult i64 %79, %34
%82 = and i1 %80, %81
br i1 %82, label %83, label %115
83: ; preds = %74
%84 = getelementptr inbounds i8, i8* %29, i64 %79
%85 = load i8, i8* %84
%86 = icmp eq i8 %85, 0
%87 = select i1 %86, i32 %78, i32 1
%88 = or i64 %44, 5
%89 = icmp ult i64 %88, %45
%90 = icmp ult i64 %88, %34
%91 = and i1 %89, %90
br i1 %91, label %92, label %115
92: ; preds = %83
%93 = getelementptr inbounds i8, i8* %29, i64 %88
%94 = load i8, i8* %93
%95 = icmp eq i8 %94, 0
%96 = select i1 %95, i32 %87, i32 1
%97 = or i64 %44, 6
%98 = icmp ult i64 %97, %45
%99 = icmp ult i64 %97, %34
%100 = and i1 %98, %99
br i1 %100, label %101, label %115
101: ; preds = %92
%102 = getelementptr inbounds i8, i8* %29, i64 %97
%103 = load i8, i8* %102
%104 = icmp eq i8 %103, 0
%105 = select i1 %104, i32 %96, i32 1
%106 = or i64 %44, 7
%107 = icmp ult i64 %106, %45
%108 = icmp ult i64 %106, %34
%109 = and i1 %107, %108
br i1 %109, label %110, label %115
110: ; preds = %101
%111 = getelementptr inbounds i8, i8* %29, i64 %106
%112 = load i8, i8* %111
%113 = icmp eq i8 %112, 0
%114 = select i1 %113, i32 %105, i32 1
br label %115
115: ; preds = %110, %101, %92, %83, %74, %65, %56, %47
%116 = phi i32 [ %51, %47 ], [ %60, %56 ], [ %69, %65 ], [ %78, %74 ], [ %87, %83 ], [ %96, %92 ], [ %105, %101 ], [ %114, %110 ]
%117 = icmp eq i32 %116, 0
br i1 %117, label %151, label %118
118: ; preds = %115
%119 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), i64 %44)
br i1 %46, label %120, label %122
120: ; preds = %118
%121 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0))
br label %149
122: ; preds = %118, %122
%123 = phi i64 [ %128, %122 ], [ %44, %118 ]
%124 = getelementptr inbounds i8, i8* %29, i64 %123
%125 = load i8, i8* %124
%126 = zext i8 %125 to i32
%127 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0), i32 %126)
%128 = add nuw i64 %123, 1
%129 = icmp ult i64 %128, %45
%130 = icmp ult i64 %128, %34
%131 = and i1 %129, %130
br i1 %131, label %122, label %132
132: ; preds = %122
%133 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0))
br label %134
134: ; preds = %132, %134
%135 = phi i64 [ %145, %134 ], [ %44, %132 ]
%136 = getelementptr inbounds i8, i8* %29, i64 %135
%137 = load i8, i8* %136
%138 = icmp ne i8 %137, 42
%139 = add i8 %137, -32
%140 = icmp ult i8 %139, 95
%141 = and i1 %138, %140
%142 = zext i8 %137 to i32
%143 = select i1 %141, i32 %142, i32 46
%144 = tail call i32 @putchar(i32 %143)
%145 = add nuw i64 %135, 1
%146 = icmp ult i64 %145, %45
%147 = icmp ult i64 %145, %34
%148 = and i1 %146, %147
br i1 %148, label %134, label %149
149: ; preds = %134, %120
%150 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.26, i64 0, i64 0))
br label %151
151: ; preds = %43, %115, %149
%152 = icmp ult i64 %45, %34
br i1 %152, label %43, label %153
153: ; preds = %151, %33
%154 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.25, i64 0, i64 0))
%155 = tail call i32 @free(i8* %29)
%156 = tail call i32 @fclose(i32* %10)
%157 = icmp eq i32 %156, 0
br i1 %157, label %160, label %158
158: ; preds = %153
%159 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.20, i64 0, i64 0))
br label %160
160: ; preds = %153, %158, %31, %23, %18, %12, %4
%161 = phi i32* [ @EXIT_FAILURE, %4 ], [ @EXIT_FAILURE, %18 ], [ @EXIT_FAILURE, %158 ], [ @EXIT_FAILURE, %31 ], [ @EXIT_FAILURE, %23 ], [ @EXIT_FAILURE, %12 ], [ @EXIT_SUCCESS, %153 ]
%162 = load i32, i32* %161
ret i32 %162
}