#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 /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, long, int /*<<< orphan*/);
unsigned long ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ fwrite(void *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
unsigned long strtoul(char *, char **, int /*<<< orphan*/);
int main(int argc, char **argv) {
  unsigned long sz;
  unsigned long as;
  unsigned long i;
  int arg;
  FILE *fh;
  static char buf[(16 * 1024)];
  if (argc < 2 || argc > 3)
    goto GiveHelp;
  if (argc == 2) {
    sz = 2 * 1024 * 1024;
    arg = 1;
  } else {
    char *ptr;
    char *ep;
    unsigned long term;
    sz = 0;
    ptr = argv[1];
    do {
      term = strtoul(ptr, &ep, 0);
      if (ep == ptr)
        term = 1;
      else
        ptr = ep;
      switch (*ptr) {
      case 'k':
      case 'K':
        term *= 1024;
        ptr++;
        break;
      case 'm':
      case 'M':
        term *= 1024 * 1024;
        ptr++;
        break;
      }
      sz += term;
      if (*ptr == '+') {
        ptr++;
        continue;
      }
      break;
    } while (1);
    if (*ptr)
      goto GiveHelp;
    arg = 2;
  }
  printf("Padding file \"%s\" to %lu (=0x%lX) bytes (all 0xFF bytes)\n",
         argv[arg], sz, sz);
  fh = fopen(argv[arg], "ab+");
  if (fh == NULL) {
    perror("Cannot open file ");
    return (1);
  }
  fseek(fh, 0L, SEEK_END);
  as = ftell(fh);
  if (as > sz) {
    printf("File is already %lud (=0x%luX) bytes long : Not truncating\n", as,
           as);
    fclose(fh);
    return (1);
  }
  for (i = 0; (i < (16 * 1024)); i++)
    buf[i] = 0xFF;
  for (; (as < sz); as += i) {
    i = (16 * 1024);
    if ((as + i) > sz)
      i = sz - as;
    fwrite((void *)buf, sizeof(char), (int)i, fh);
  }
  fclose(fh);
  return (0);
GiveHelp:
  printf("Format : brompad [<size>] <file-name>\n");
  printf("Pads the given file to a size using 0xFF bytes\n");
  printf("<size> by default is 2 MegaBytes\n");
  printf("<size> can be specified in C-format integer constants\n");
  printf("(Hence you can use hex, octal or decimal)\n");
  printf("A constant may be suffixed by k or K for kilo-bytes\n");
  printf("A constant may be suffixed by m or M for mega-bytes\n");
  printf("You can add any number of such costants together using '+'\n");
  return (1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jl     11aa <main+0x2a>
cmpl   $0x3,-0x8(%rbp)
jle    11af <main+0x2f>
jmp    1440 <main+0x2c0>
cmpl   $0x2,-0x8(%rbp)
jne    11cd <main+0x4d>
movq   $0x200000,-0x18(%rbp)
movl   $0x1,-0x2c(%rbp)
jmp    12d3 <main+0x153>
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
lea    -0x48(%rbp),%rsi
xor    %edx,%edx
call   1090 <strtoul@plt>
mov    %rax,-0x50(%rbp)
mov    -0x48(%rbp),%rax
cmp    -0x40(%rbp),%rax
jne    120f <main+0x8f>
movq   $0x1,-0x50(%rbp)
jmp    1217 <main+0x97>
mov    -0x48(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
movsbl (%rax),%eax
add    $0xffffffb5,%eax
mov    %eax,%ecx
mov    %rcx,-0x58(%rbp)
sub    $0x22,%eax
ja     1279 <main+0xf9>
mov    -0x58(%rbp),%rax
lea    0xdc5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x50(%rbp),%rax
shl    $0xa,%rax
mov    %rax,-0x50(%rbp)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    1279 <main+0xf9>
mov    -0x50(%rbp),%rax
shl    $0x14,%rax
mov    %rax,-0x50(%rbp)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
mov    -0x50(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x40(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2b,%eax
jne    12a6 <main+0x126>
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    12ab <main+0x12b>
jmp    12ba <main+0x13a>
mov    $0x1,%al
test   $0x1,%al
jne    11e1 <main+0x61>
jmp    12ba <main+0x13a>
mov    -0x40(%rbp),%rax
cmpb   $0x0,(%rax)
je     12cc <main+0x14c>
jmp    1440 <main+0x2c0>
movl   $0x2,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xd9e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdbe(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    1334 <main+0x1b4>
lea    0xda7(%rip),%rdi
call   1080 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    14b7 <main+0x337>
mov    -0x38(%rbp),%rdi
mov    0x2ca9(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   1060 <fseek@plt>
mov    -0x38(%rbp),%rdi
call   1050 <ftell@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jbe    1390 <main+0x210>
mov    -0x20(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xd68(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x38(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    14b7 <main+0x337>
movq   $0x0,-0x28(%rbp)
cmpq   $0x4000,-0x28(%rbp)
jae    13c6 <main+0x246>
mov    -0x28(%rbp),%rcx
lea    0x2cbf(%rip),%rax
movb   $0xff,(%rax,%rcx,1)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1398 <main+0x218>
jmp    13cb <main+0x24b>
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    142b <main+0x2ab>
movq   $0x4000,-0x28(%rbp)
mov    -0x20(%rbp),%rax
add    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jbe    13ff <main+0x27f>
mov    -0x18(%rbp),%rax
sub    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %eax,%edx
mov    -0x38(%rbp),%rcx
lea    0x2c60(%rip),%rdi
mov    $0x1,%esi
call   10a0 <fwrite@plt>
mov    -0x28(%rbp),%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    13cb <main+0x24b>
mov    -0x38(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
jmp    14b7 <main+0x337>
lea    0xcd1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xcea(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd0c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd20(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd49(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd66(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd8d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdb4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    -0x4(%rdi),%eax
cmp    $0xfffffffe,%eax
jae    1218 <main+0x78>
lea    0xf5e(%rip),%rdi
call   1030 <puts@plt>
lea    0xf78(%rip),%rdi
call   1030 <puts@plt>
lea    0xf9b(%rip),%rdi
call   1030 <puts@plt>
lea    0xfb0(%rip),%rdi
call   1030 <puts@plt>
lea    0xfda(%rip),%rdi
call   1030 <puts@plt>
lea    0xff8(%rip),%rdi
call   1030 <puts@plt>
lea    0x1020(%rip),%rdi
call   1030 <puts@plt>
lea    0x1048(%rip),%rdi
call   1030 <puts@plt>
jmp    1327 <main+0x187>
mov    %rsi,%r14
cmp    $0x2,%edi
jne    1230 <main+0x90>
mov    $0x1,%ebx
mov    $0x200000,%r12d
jmp    12b4 <main+0x114>
mov    0x8(%r14),%rbx
xor    %r12d,%r12d
mov    %rsp,%r15
mov    $0x1,%r13d
lea    0xdb9(%rip),%rbp
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %edx,%edx
call   10b0 <strtoul@plt>
mov    (%rsp),%rdx
cmp    %rbx,%rdx
cmove  %r13,%rax
movsbl (%rdx),%esi
mov    %esi,%edi
add    $0xffffffb5,%edi
cmp    $0x22,%edi
ja     1294 <main+0xf4>
mov    $0xa,%ecx
movslq 0x0(%rbp,%rdi,4),%rdi
add    %rbp,%rdi
jmp    *%rdi
mov    $0x14,%ecx
shl    %cl,%rax
movzbl 0x1(%rdx),%esi
add    $0x1,%rdx
add    %rax,%r12
cmp    $0x2b,%sil
jne    12a6 <main+0x106>
add    $0x1,%rdx
mov    %rdx,%rbx
jmp    1250 <main+0xb0>
test   %sil,%sil
jne    11b3 <main+0x13>
mov    $0x2,%ebx
mov    (%r14,%rbx,8),%rsi
lea    0xdcd(%rip),%rdi
mov    %r12,%rdx
mov    %r12,%rcx
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%r14,%rbx,8),%rdi
lea    0xdef(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     13aa <main+0x20a>
mov    %rax,%r14
mov    0x2cf9(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1080 <fseek@plt>
mov    %r14,%rdi
call   1070 <ftell@plt>
mov    %rax,%r13
cmp    %r12,%rax
jbe    133b <main+0x19b>
lea    0xdca(%rip),%rdi
mov    %r13,%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x2d3e(%rip),%rdi
mov    $0x4000,%ebp
mov    $0x4000,%edx
mov    $0xff,%esi
call   1060 <memset@plt>
cmp    %r13,%r12
jbe    139e <main+0x1fe>
lea    0x2d1e(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0x4000(%r13),%rax
mov    %r12,%rbx
sub    %r13,%rbx
cmp    %r12,%rax
cmovbe %rbp,%rbx
mov    %r15,%rdi
mov    $0x1,%esi
mov    %ebx,%edx
mov    %r14,%rcx
call   10c0 <fwrite@plt>
add    %rbx,%r13
cmp    %r13,%r12
ja     1370 <main+0x1d0>
mov    %r14,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
jmp    132c <main+0x18c>
lea    0xd19(%rip),%rdi
call   10a0 <perror@plt>
jmp    1327 <main+0x187>

LLVM IR (-O0):
@main.buf = internal global [16384 x i8] zeroinitializer
@.str = [58 x i8] c"Padding file \22%s\22 to %lu (=0x%lX) bytes (all 0xFF bytes)\0A\00"
@.str.1 = [4 x i8] c"ab+\00"
@.str.2 = [18 x i8] c"Cannot open file \00"
@SEEK_END = global i32 0
@.str.3 = [60 x i8] c"File is already %lud (=0x%luX) bytes long : Not truncating\0A\00"
@.str.4 = [39 x i8] c"Format : brompad [<size>] <file-name>\0A\00"
@.str.5 = [48 x i8] c"Pads the given file to a size using 0xFF bytes\0A\00"
@.str.6 = [34 x i8] c"<size> by default is 2 MegaBytes\0A\00"
@.str.7 = [55 x i8] c"<size> can be specified in C-format integer constants\0A\00"
@.str.8 = [43 x i8] c"(Hence you can use hex, octal or decimal)\0A\00"
@.str.9 = [53 x i8] c"A constant may be suffixed by k or K for kilo-bytes\0A\00"
@.str.10 = [53 x i8] c"A constant may be suffixed by m or M for mega-bytes\0A\00"
@.str.11 = [60 x i8] c"You can add any number of such costants together using '+'\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 2
br i1 %15, label %19, label %16
16: ; preds = %2
%17 = load i32, i32* %4
%18 = icmp sgt i32 %17, 3
br i1 %18, label %19, label %20
19: ; preds = %16, %2
br label %141
20: ; preds = %16
%21 = load i32, i32* %4
%22 = icmp eq i32 %21, 2
br i1 %22, label %23, label %24
23: ; preds = %20
store i64 2097152, i64* %6
store i32 1, i32* %9
br label %70
24: ; preds = %20
store i64 0, i64* %6
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
store i8* %27, i8** %11
br label %28
28: ; preds = %63, %24
%29 = load i8*, i8** %11
%30 = call i64 @strtoul(i8* %29, i8** %12, i32 0)
store i64 %30, i64* %13
%31 = load i8*, i8** %12
%32 = load i8*, i8** %11
%33 = icmp eq i8* %31, %32
br i1 %33, label %34, label %35
34: ; preds = %28
store i64 1, i64* %13
br label %37
35: ; preds = %28
%36 = load i8*, i8** %12
store i8* %36, i8** %11
br label %37
37: ; preds = %35, %34
%38 = load i8*, i8** %11
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
switch i32 %40, label %51 [
i32 107, label %41
i32 75, label %41
i32 109, label %46
i32 77, label %46
]
41: ; preds = %37, %37
%42 = load i64, i64* %13
%43 = mul i64 %42, 1024
store i64 %43, i64* %13
%44 = load i8*, i8** %11
%45 = getelementptr inbounds i8, i8* %44, i32 1
store i8* %45, i8** %11
br label %51
46: ; preds = %37, %37
%47 = load i64, i64* %13
%48 = mul i64 %47, 1048576
store i64 %48, i64* %13
%49 = load i8*, i8** %11
%50 = getelementptr inbounds i8, i8* %49, i32 1
store i8* %50, i8** %11
br label %51
51: ; preds = %37, %46, %41
%52 = load i64, i64* %13
%53 = load i64, i64* %6
%54 = add i64 %53, %52
store i64 %54, i64* %6
%55 = load i8*, i8** %11
%56 = load i8, i8* %55
%57 = sext i8 %56 to i32
%58 = icmp eq i32 %57, 43
br i1 %58, label %59, label %62
59: ; preds = %51
%60 = load i8*, i8** %11
%61 = getelementptr inbounds i8, i8* %60, i32 1
store i8* %61, i8** %11
br label %63
62: ; preds = %51
br label %64
63: ; preds = %59
br i1 true, label %28, label %64
64: ; preds = %63, %62
%65 = load i8*, i8** %11
%66 = load i8, i8* %65
%67 = icmp ne i8 %66, 0
br i1 %67, label %68, label %69
68: ; preds = %64
br label %141
69: ; preds = %64
store i32 2, i32* %9
br label %70
70: ; preds = %69, %23
%71 = load i8**, i8*** %5
%72 = load i32, i32* %9
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds i8*, i8** %71, i64 %73
%75 = load i8*, i8** %74
%76 = load i64, i64* %6
%77 = load i64, i64* %6
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i8* %75, i64 %76, i64 %77)
%79 = load i8**, i8*** %5
%80 = load i32, i32* %9
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds i8*, i8** %79, i64 %81
%83 = load i8*, i8** %82
%84 = call i32* @fopen(i8* %83, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32* %84, i32** %10
%85 = load i32*, i32** %10
%86 = icmp eq i32* %85, null
br i1 %86, label %87, label %89
87: ; preds = %70
%88 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %150
89: ; preds = %70
%90 = load i32*, i32** %10
%91 = load i32, i32* @SEEK_END
%92 = call i32 @fseek(i32* %90, i64 0, i32 %91)
%93 = load i32*, i32** %10
%94 = call i64 @ftell(i32* %93)
store i64 %94, i64* %7
%95 = load i64, i64* %7
%96 = load i64, i64* %6
%97 = icmp ugt i64 %95, %96
br i1 %97, label %98, label %104
98: ; preds = %89
%99 = load i64, i64* %7
%100 = load i64, i64* %7
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.3, i64 0, i64 0), i64 %99, i64 %100)
%102 = load i32*, i32** %10
%103 = call i32 @fclose(i32* %102)
store i32 1, i32* %3
br label %150
104: ; preds = %89
store i64 0, i64* %8
br label %105
105: ; preds = %111, %104
%106 = load i64, i64* %8
%107 = icmp ult i64 %106, 16384
br i1 %107, label %108, label %114
108: ; preds = %105
%109 = load i64, i64* %8
%110 = getelementptr inbounds [16384 x i8], [16384 x i8]* @main.buf, i64 0, i64 %109
store i8 -1, i8* %110
br label %111
111: ; preds = %108
%112 = load i64, i64* %8
%113 = add i64 %112, 1
store i64 %113, i64* %8
br label %105
114: ; preds = %105
br label %115
115: ; preds = %134, %114
%116 = load i64, i64* %7
%117 = load i64, i64* %6
%118 = icmp ult i64 %116, %117
br i1 %118, label %119, label %138
119: ; preds = %115
store i64 16384, i64* %8
%120 = load i64, i64* %7
%121 = load i64, i64* %8
%122 = add i64 %120, %121
%123 = load i64, i64* %6
%124 = icmp ugt i64 %122, %123
br i1 %124, label %125, label %129
125: ; preds = %119
%126 = load i64, i64* %6
%127 = load i64, i64* %7
%128 = sub i64 %126, %127
store i64 %128, i64* %8
br label %129
129: ; preds = %125, %119
%130 = load i64, i64* %8
%131 = trunc i64 %130 to i32
%132 = load i32*, i32** %10
%133 = call i32 @fwrite(i8* getelementptr inbounds ([16384 x i8], [16384 x i8]* @main.buf, i64 0, i64 0), i32 1, i32 %131, i32* %132)
br label %134
134: ; preds = %129
%135 = load i64, i64* %8
%136 = load i64, i64* %7
%137 = add i64 %136, %135
store i64 %137, i64* %7
br label %115
138: ; preds = %115
%139 = load i32*, i32** %10
%140 = call i32 @fclose(i32* %139)
store i32 0, i32* %3
br label %150
141: ; preds = %68, %19
%142 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0))
%143 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i64 0, i64 0))
%144 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
%145 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.7, i64 0, i64 0))
%146 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.8, i64 0, i64 0))
%147 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.9, i64 0, i64 0))
%148 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.10, i64 0, i64 0))
%149 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.11, i64 0, i64 0))
store i32 1, i32* %3
br label %150
150: ; preds = %141, %138, %98, %87
%151 = load i32, i32* %3
ret i32 %151
}

LLVM IR (-O2):
@main.buf = internal global [16384 x i8] zeroinitializer
@.str = [58 x i8] c"Padding file \22%s\22 to %lu (=0x%lX) bytes (all 0xFF bytes)\0A\00"
@.str.1 = [4 x i8] c"ab+\00"
@.str.2 = [18 x i8] c"Cannot open file \00"
@SEEK_END = global i32 0
@.str.3 = [60 x i8] c"File is already %lud (=0x%luX) bytes long : Not truncating\0A\00"
@str = [38 x i8] c"Format : brompad [<size>] <file-name>\00"
@str.12 = [47 x i8] c"Pads the given file to a size using 0xFF bytes\00"
@str.13 = [33 x i8] c"<size> by default is 2 MegaBytes\00"
@str.14 = [54 x i8] c"<size> can be specified in C-format integer constants\00"
@str.15 = [42 x i8] c"(Hence you can use hex, octal or decimal)\00"
@str.16 = [52 x i8] c"A constant may be suffixed by k or K for kilo-bytes\00"
@str.17 = [52 x i8] c"A constant may be suffixed by m or M for mega-bytes\00"
@str.18 = [59 x i8] c"You can add any number of such costants together using '+'\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = add i32 %0, -4
%5 = icmp ult i32 %4, -2
br i1 %5, label %69, label %6
6: ; preds = %2
%7 = icmp eq i32 %0, 2
br i1 %7, label %36, label %8
8: ; preds = %6
%9 = bitcast i8** %3 to i8*
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
br label %12
12: ; preds = %32, %8
%13 = phi i64 [ 0, %8 ], [ %31, %32 ]
%14 = phi i8* [ %11, %8 ], [ %33, %32 ]
%15 = call i64 @strtoul(i8* %14, i8** %3, i32 0)
%16 = load i8*, i8** %3
%17 = icmp eq i8* %16, %14
%18 = select i1 %17, i64 1, i64 %15
%19 = load i8, i8* %16
%20 = sext i8 %19 to i32
switch i32 %20, label %27 [
i32 107, label %22
i32 75, label %22
i32 109, label %21
i32 77, label %21
]
21: ; preds = %12, %12
br label %22
22: ; preds = %12, %12, %21
%23 = phi i64 [ 20, %21 ], [ 10, %12 ], [ 10, %12 ]
%24 = shl i64 %18, %23
%25 = getelementptr inbounds i8, i8* %16, i64 1
%26 = load i8, i8* %25
br label %27
27: ; preds = %22, %12
%28 = phi i8 [ %26, %22 ], [ %19, %12 ]
%29 = phi i8* [ %25, %22 ], [ %16, %12 ]
%30 = phi i64 [ %24, %22 ], [ %18, %12 ]
%31 = add i64 %30, %13
switch i8 %28, label %35 [
i8 43, label %32
i8 0, label %34
]
32: ; preds = %27
%33 = getelementptr inbounds i8, i8* %29, i64 1
br label %12
34: ; preds = %27
br label %36
35: ; preds = %27
br label %69
36: ; preds = %34, %6
%37 = phi i64 [ 2097152, %6 ], [ %31, %34 ]
%38 = phi i64 [ 1, %6 ], [ 2, %34 ]
%39 = getelementptr inbounds i8*, i8** %1, i64 %38
%40 = load i8*, i8** %39
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i8* %40, i64 %37, i64 %37)
%42 = load i8*, i8** %39
%43 = tail call i32* @fopen(i8* %42, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%44 = icmp eq i32* %43, null
br i1 %44, label %45, label %47
45: ; preds = %36
%46 = tail call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %78
47: ; preds = %36
%48 = load i32, i32* @SEEK_END
%49 = tail call i32 @fseek(i32* %43, i64 0, i32 %48)
%50 = tail call i64 @ftell(i32* %43)
%51 = icmp ugt i64 %50, %37
br i1 %51, label %54, label %52
52: ; preds = %47
%53 = icmp ugt i64 %37, %50
br i1 %53, label %57, label %67
54: ; preds = %47
%55 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.3, i64 0, i64 0), i64 %50, i64 %50)
%56 = tail call i32 @fclose(i32* %43)
br label %78
57: ; preds = %52, %57
%58 = phi i64 [ %65, %57 ], [ %50, %52 ]
%59 = add i64 %58, 16384
%60 = icmp ugt i64 %59, %37
%61 = sub i64 %37, %58
%62 = select i1 %60, i64 %61, i64 16384
%63 = trunc i64 %62 to i32
%64 = tail call i32 @fwrite(i8* getelementptr inbounds ([16384 x i8], [16384 x i8]* @main.buf, i64 0, i64 0), i32 1, i32 %63, i32* %43)
%65 = add i64 %62, %58
%66 = icmp ugt i64 %37, %65
br i1 %66, label %57, label %67
67: ; preds = %57, %52
%68 = tail call i32 @fclose(i32* %43)
br label %78
69: ; preds = %35, %2
%70 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%71 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str.12, i64 0, i64 0))
%72 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.13, i64 0, i64 0))
%73 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str.14, i64 0, i64 0))
%74 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.15, i64 0, i64 0))
%75 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str.16, i64 0, i64 0))
%76 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str.17, i64 0, i64 0))
%77 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.18, i64 0, i64 0))
br label %78
78: ; preds = %69, %67, %54, %45
%79 = phi i32 [ 1, %69 ], [ 1, %45 ], [ 1, %54 ], [ 0, %67 ]
ret i32 %79
}