#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*/ SEEK_SET;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, long, int /*<<< orphan*/);
long ftell(int /*<<< orphan*/ *);
short getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putc(short, int /*<<< orphan*/ *);
char *strcat(char *, char *);
short strlen(char *);
int main(int argc, char *argv[]) {
  FILE *in, *out;
  long seg, segdata;
  short i, o;
  char label[34] = "";
  short infile = 1;
  if (argc < 3) {
    printf("usage : bin2obj [-u] infile outfile\n");
    return (-1);
  }
  if (argc == 4)
    if ((argv[1][0] == '-') && ((argv[1][1] == 'u') || (argv[1][1] == 'U'))) {
      label[0] = '_';
      label[1] = 0;
      ++infile;
    }
  if ((in = fopen(argv[infile], "rb")) == NULL) {
    printf("Couldn't open %s !\n", argv[infile]);
    return (-1);
  }
  ++infile;
  strcat(label, argv[infile]);
  if ((out = fopen(strcat(argv[infile], ".obj"), "wb")) == NULL) {
    printf("Couldn't open %s !\n", argv[infile]);
    return (-1);
  }
  fseek(in, 0L, SEEK_END);
  seg = ftell(in);
  fseek(in, 0L, SEEK_SET);
  segdata = seg + ((seg + 0x1f) >> 5);
  putc(0xfd, out);
  putc(0xfd, out);
  putc(7 + (char)strlen(label), out);
  putc(0, out);
  putc(seg & 0xff, out);
  putc(seg >> 8, out);
  putc(segdata & 0xff, out);
  putc(segdata >> 8, out);
  putc(1, out);
  putc(0, out);
  putc(strlen(label), out);
  fprintf(out, "%s", label);
  putc(0, out);
  putc(0, out);
  putc(7, out);
  putc(0, out);
  for (i = seg >> 5; i; --i) {
    putc(0, out);
    for (o = 32; o; --o)
      putc(getc(in), out);
  }
  if ((i = seg & 0x1f)) {
    putc(i, out);
    for (; i; --i)
      putc(getc(in), out);
  }
  fclose(in);
  fclose(out);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x22,%edx
call   1060 <memset@plt>
movw   $0x1,-0x62(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1200 <main+0x50>
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1569 <main+0x3b9>
cmpl   $0x4,-0x8(%rbp)
jne    1261 <main+0xb1>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    125c <main+0xac>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl 0x1(%rax),%eax
cmp    $0x75,%eax
je     1248 <main+0x98>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl 0x1(%rax),%eax
cmp    $0x55,%eax
jne    125c <main+0xac>
movb   $0x5f,-0x60(%rbp)
movb   $0x0,-0x5f(%rbp)
mov    -0x62(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x62(%rbp)
jmp    1261 <main+0xb1>
mov    -0x10(%rbp),%rax
movswq -0x62(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdb0(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    12af <main+0xff>
mov    -0x10(%rbp),%rax
movswq -0x62(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xd8c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1569 <main+0x3b9>
mov    -0x62(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x62(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%rax
movswq -0x62(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   10c0 <strcat@plt>
mov    -0x10(%rbp),%rax
movswq -0x62(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd57(%rip),%rsi
call   10c0 <strcat@plt>
mov    %rax,%rdi
lea    0xd4d(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    132e <main+0x17e>
mov    -0x10(%rbp),%rax
movswq -0x62(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xd0d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1569 <main+0x3b9>
mov    -0x18(%rbp),%rdi
mov    0x2caf(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   10a0 <fseek@plt>
mov    -0x18(%rbp),%rdi
call   1090 <ftell@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2c7c(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   10a0 <fseek@plt>
mov    -0x28(%rbp),%rax
mov    -0x28(%rbp),%rcx
add    $0x1f,%rcx
sar    $0x5,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rsi
mov    $0xfd,%edi
call   1070 <putc@plt>
mov    -0x20(%rbp),%rsi
mov    $0xfd,%edi
call   1070 <putc@plt>
lea    -0x60(%rbp),%rdi
call   1040 <strlen@plt>
movsbl %al,%eax
add    $0x7,%eax
mov    -0x20(%rbp),%rsi
movswl %ax,%edi
call   1070 <putc@plt>
mov    -0x20(%rbp),%rsi
xor    %edi,%edi
call   1070 <putc@plt>
mov    -0x28(%rbp),%rax
and    $0xff,%rax
mov    -0x20(%rbp),%rsi
movswl %ax,%edi
call   1070 <putc@plt>
mov    -0x28(%rbp),%rax
sar    $0x8,%rax
mov    -0x20(%rbp),%rsi
movswl %ax,%edi
call   1070 <putc@plt>
mov    -0x30(%rbp),%rax
and    $0xff,%rax
mov    -0x20(%rbp),%rsi
movswl %ax,%edi
call   1070 <putc@plt>
mov    -0x30(%rbp),%rax
sar    $0x8,%rax
mov    -0x20(%rbp),%rsi
movswl %ax,%edi
call   1070 <putc@plt>
mov    -0x20(%rbp),%rsi
mov    $0x1,%edi
call   1070 <putc@plt>
mov    -0x20(%rbp),%rsi
xor    %edi,%edi
call   1070 <putc@plt>
lea    -0x60(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rsi
movswl %ax,%edi
call   1070 <putc@plt>
mov    -0x20(%rbp),%rdi
lea    -0x60(%rbp),%rdx
lea    0xbf3(%rip),%rsi
call   1080 <fprintf@plt>
mov    -0x20(%rbp),%rsi
xor    %edi,%edi
call   1070 <putc@plt>
mov    -0x20(%rbp),%rsi
xor    %edi,%edi
call   1070 <putc@plt>
mov    -0x20(%rbp),%rsi
mov    $0x7,%edi
call   1070 <putc@plt>
mov    -0x20(%rbp),%rsi
xor    %edi,%edi
call   1070 <putc@plt>
mov    -0x28(%rbp),%rax
sar    $0x5,%rax
mov    %ax,-0x32(%rbp)
cmpw   $0x0,-0x32(%rbp)
je     14f4 <main+0x344>
mov    -0x20(%rbp),%rsi
xor    %edi,%edi
call   1070 <putc@plt>
movw   $0x20,-0x34(%rbp)
cmpw   $0x0,-0x34(%rbp)
je     14de <main+0x32e>
mov    -0x18(%rbp),%rdi
call   10d0 <getc@plt>
mov    -0x20(%rbp),%rsi
movswl %ax,%edi
call   1070 <putc@plt>
mov    -0x34(%rbp),%ax
add    $0xffff,%ax
mov    %ax,-0x34(%rbp)
jmp    14ad <main+0x2fd>
jmp    14e3 <main+0x333>
mov    -0x32(%rbp),%ax
add    $0xffff,%ax
mov    %ax,-0x32(%rbp)
jmp    1491 <main+0x2e1>
mov    -0x28(%rbp),%rax
and    $0x1f,%rax
mov    %ax,-0x32(%rbp)
cmp    $0x0,%ax
je     1550 <main+0x3a0>
mov    -0x32(%rbp),%ax
mov    -0x20(%rbp),%rsi
movswl %ax,%edi
call   1070 <putc@plt>
cmpw   $0x0,-0x32(%rbp)
je     154b <main+0x39b>
mov    -0x18(%rbp),%rdi
call   10d0 <getc@plt>
mov    -0x20(%rbp),%rsi
movswl %ax,%edi
call   1070 <putc@plt>
mov    -0x32(%rbp),%ax
add    $0xffff,%ax
mov    %ax,-0x32(%rbp)
jmp    151a <main+0x36a>
jmp    1550 <main+0x3a0>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movw   $0x0,0x20(%rsp)
cmp    $0x2,%edi
jg     11e7 <main+0x37>
lea    0xe42(%rip),%rdi
call   1030 <puts@plt>
jmp    1424 <main+0x274>
mov    %rsi,%r15
mov    $0x1,%ax
cmp    $0x4,%edi
jne    120f <main+0x5f>
mov    0x8(%r15),%rcx
cmpb   $0x2d,(%rcx)
jne    120f <main+0x5f>
mov    0x1(%rcx),%cl
or     $0x20,%cl
cmp    $0x75,%cl
jne    120f <main+0x5f>
movb   $0x5f,(%rsp)
mov    $0x2,%ax
movzwl %ax,%r12d
mov    (%r15,%r12,8),%rdi
lea    0xde2(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     1412 <main+0x262>
mov    %rax,%r14
mov    0x8(%r15,%r12,8),%rbx
mov    %rsp,%rdi
mov    %rbx,%rsi
call   10c0 <strcat@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
movl   $0x6a626f2e,(%rbx,%rax,1)
movb   $0x0,0x4(%rbx,%rax,1)
lea    0xdc2(%rip),%rsi
mov    %rbx,%rdi
call   10b0 <fopen@plt>
test   %rax,%rax
je     140e <main+0x25e>
mov    %rax,%rbx
mov    0x2d73(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
xor    %esi,%esi
call   10a0 <fseek@plt>
mov    %r14,%rdi
call   1090 <ftell@plt>
mov    %rax,%r15
mov    0x2d45(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
xor    %esi,%esi
call   10a0 <fseek@plt>
lea    0x1f(%r15),%r13
shr    $0x5,%r13
add    %r15d,%r13d
mov    $0xfd,%edi
mov    %rbx,%rsi
call   1080 <putc@plt>
mov    $0xfd,%edi
mov    %rbx,%rsi
call   1080 <putc@plt>
mov    %rsp,%r12
mov    %r12,%rdi
call   1050 <strlen@plt>
movsbl %al,%edi
add    $0x7,%edi
mov    %rbx,%rsi
call   1080 <putc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1080 <putc@plt>
movzbl %r15b,%edi
mov    %rbx,%rsi
call   1080 <putc@plt>
mov    %r15d,%eax
shr    $0x8,%eax
movswl %ax,%edi
mov    %rbx,%rsi
call   1080 <putc@plt>
movzbl %r13b,%edi
mov    %rbx,%rsi
call   1080 <putc@plt>
shr    $0x8,%r13d
movswl %r13w,%edi
mov    %rbx,%rsi
call   1080 <putc@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
call   1080 <putc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1080 <putc@plt>
mov    %r12,%rdi
call   1050 <strlen@plt>
movswl %ax,%edi
mov    %rbx,%rsi
call   1080 <putc@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1070 <fputs@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1080 <putc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1080 <putc@plt>
mov    $0x7,%edi
mov    %rbx,%rsi
call   1080 <putc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1080 <putc@plt>
mov    %r15,%r12
shr    $0x5,%r12
test   %r12w,%r12w
je     13bf <main+0x20f>
nopl   (%rax)
xor    %edi,%edi
mov    %rbx,%rsi
call   1080 <putc@plt>
mov    $0xffe0,%bp
xchg   %ax,%ax
mov    %r14,%rdi
call   10d0 <getc@plt>
movswl %ax,%edi
mov    %rbx,%rsi
call   1080 <putc@plt>
inc    %bp
jne    13a0 <main+0x1f0>
add    $0xffff,%r12w
jne    1390 <main+0x1e0>
and    $0x1f,%r15w
je     13fa <main+0x24a>
movswl %r15w,%edi
mov    %rbx,%rsi
call   1080 <putc@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
call   10d0 <getc@plt>
movswl %ax,%edi
mov    %rbx,%rsi
call   1080 <putc@plt>
add    $0xffff,%r15w
jne    13e0 <main+0x230>
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
jmp    1429 <main+0x279>
add    $0x1,%r12
mov    (%r15,%r12,8),%rsi
lea    0xbe6(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xffffffff,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [37 x i8] c"usage : bin2obj [-u] infile outfile\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [20 x i8] c"Couldn't open %s !\0A\00"
@.str.3 = [5 x i8] c".obj\00"
@.str.4 = [3 x i8] c"wb\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.5 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i64
%9 = alloca i64
%10 = alloca i16
%11 = alloca i16
%12 = alloca [34 x i8]
%13 = alloca i16
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = bitcast [34 x i8]* %12 to i8*
store i16 1, i16* %13
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 3
br i1 %16, label %17, label %19
17: ; preds = %2
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %209
19: ; preds = %2
%20 = load i32, i32* %4
%21 = icmp eq i32 %20, 4
br i1 %21, label %22, label %52
22: ; preds = %19
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = getelementptr inbounds i8, i8* %25, i64 0
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 45
br i1 %29, label %30, label %51
30: ; preds = %22
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = getelementptr inbounds i8, i8* %33, i64 1
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 117
br i1 %37, label %46, label %38
38: ; preds = %30
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 1
%41 = load i8*, i8** %40
%42 = getelementptr inbounds i8, i8* %41, i64 1
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 85
br i1 %45, label %46, label %51
46: ; preds = %38, %30
%47 = getelementptr inbounds [34 x i8], [34 x i8]* %12, i64 0, i64 0
store i8 95, i8* %47
%48 = getelementptr inbounds [34 x i8], [34 x i8]* %12, i64 0, i64 1
store i8 0, i8* %48
%49 = load i16, i16* %13
%50 = add i16 %49, 1
store i16 %50, i16* %13
br label %51
51: ; preds = %46, %38, %22
br label %52
52: ; preds = %51, %19
%53 = load i8**, i8*** %5
%54 = load i16, i16* %13
%55 = sext i16 %54 to i64
%56 = getelementptr inbounds i8*, i8** %53, i64 %55
%57 = load i8*, i8** %56
%58 = call i32* @fopen(i8* %57, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %58, i32** %6
%59 = icmp eq i32* %58, null
br i1 %59, label %60, label %67
60: ; preds = %52
%61 = load i8**, i8*** %5
%62 = load i16, i16* %13
%63 = sext i16 %62 to i64
%64 = getelementptr inbounds i8*, i8** %61, i64 %63
%65 = load i8*, i8** %64
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %65)
store i32 -1, i32* %3
br label %209
67: ; preds = %52
%68 = load i16, i16* %13
%69 = add i16 %68, 1
store i16 %69, i16* %13
%70 = getelementptr inbounds [34 x i8], [34 x i8]* %12, i64 0, i64 0
%71 = load i8**, i8*** %5
%72 = load i16, i16* %13
%73 = sext i16 %72 to i64
%74 = getelementptr inbounds i8*, i8** %71, i64 %73
%75 = load i8*, i8** %74
%76 = call i8* @strcat(i8* %70, i8* %75)
%77 = load i8**, i8*** %5
%78 = load i16, i16* %13
%79 = sext i16 %78 to i64
%80 = getelementptr inbounds i8*, i8** %77, i64 %79
%81 = load i8*, i8** %80
%82 = call i8* @strcat(i8* %81, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%83 = call i32* @fopen(i8* %82, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32* %83, i32** %7
%84 = icmp eq i32* %83, null
br i1 %84, label %85, label %92
85: ; preds = %67
%86 = load i8**, i8*** %5
%87 = load i16, i16* %13
%88 = sext i16 %87 to i64
%89 = getelementptr inbounds i8*, i8** %86, i64 %88
%90 = load i8*, i8** %89
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %90)
store i32 -1, i32* %3
br label %209
92: ; preds = %67
%93 = load i32*, i32** %6
%94 = load i32, i32* @SEEK_END
%95 = call i32 @fseek(i32* %93, i64 0, i32 %94)
%96 = load i32*, i32** %6
%97 = call i64 @ftell(i32* %96)
store i64 %97, i64* %8
%98 = load i32*, i32** %6
%99 = load i32, i32* @SEEK_SET
%100 = call i32 @fseek(i32* %98, i64 0, i32 %99)
%101 = load i64, i64* %8
%102 = load i64, i64* %8
%103 = add nsw i64 %102, 31
%104 = ashr i64 %103, 5
%105 = add nsw i64 %101, %104
store i64 %105, i64* %9
%106 = load i32*, i32** %7
%107 = call i32 @putc(i16 signext 253, i32* %106)
%108 = load i32*, i32** %7
%109 = call i32 @putc(i16 signext 253, i32* %108)
%110 = getelementptr inbounds [34 x i8], [34 x i8]* %12, i64 0, i64 0
%111 = call signext i16 @strlen(i8* %110)
%112 = trunc i16 %111 to i8
%113 = sext i8 %112 to i32
%114 = add nsw i32 7, %113
%115 = trunc i32 %114 to i16
%116 = load i32*, i32** %7
%117 = call i32 @putc(i16 signext %115, i32* %116)
%118 = load i32*, i32** %7
%119 = call i32 @putc(i16 signext 0, i32* %118)
%120 = load i64, i64* %8
%121 = and i64 %120, 255
%122 = trunc i64 %121 to i16
%123 = load i32*, i32** %7
%124 = call i32 @putc(i16 signext %122, i32* %123)
%125 = load i64, i64* %8
%126 = ashr i64 %125, 8
%127 = trunc i64 %126 to i16
%128 = load i32*, i32** %7
%129 = call i32 @putc(i16 signext %127, i32* %128)
%130 = load i64, i64* %9
%131 = and i64 %130, 255
%132 = trunc i64 %131 to i16
%133 = load i32*, i32** %7
%134 = call i32 @putc(i16 signext %132, i32* %133)
%135 = load i64, i64* %9
%136 = ashr i64 %135, 8
%137 = trunc i64 %136 to i16
%138 = load i32*, i32** %7
%139 = call i32 @putc(i16 signext %137, i32* %138)
%140 = load i32*, i32** %7
%141 = call i32 @putc(i16 signext 1, i32* %140)
%142 = load i32*, i32** %7
%143 = call i32 @putc(i16 signext 0, i32* %142)
%144 = getelementptr inbounds [34 x i8], [34 x i8]* %12, i64 0, i64 0
%145 = call signext i16 @strlen(i8* %144)
%146 = load i32*, i32** %7
%147 = call i32 @putc(i16 signext %145, i32* %146)
%148 = load i32*, i32** %7
%149 = getelementptr inbounds [34 x i8], [34 x i8]* %12, i64 0, i64 0
%150 = call i32 @fprintf(i32* %148, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %149)
%151 = load i32*, i32** %7
%152 = call i32 @putc(i16 signext 0, i32* %151)
%153 = load i32*, i32** %7
%154 = call i32 @putc(i16 signext 0, i32* %153)
%155 = load i32*, i32** %7
%156 = call i32 @putc(i16 signext 7, i32* %155)
%157 = load i32*, i32** %7
%158 = call i32 @putc(i16 signext 0, i32* %157)
%159 = load i64, i64* %8
%160 = ashr i64 %159, 5
%161 = trunc i64 %160 to i16
store i16 %161, i16* %10
br label %162
162: ; preds = %180, %92
%163 = load i16, i16* %10
%164 = icmp ne i16 %163, 0
br i1 %164, label %165, label %183
165: ; preds = %162
%166 = load i32*, i32** %7
%167 = call i32 @putc(i16 signext 0, i32* %166)
store i16 32, i16* %11
br label %168
168: ; preds = %176, %165
%169 = load i16, i16* %11
%170 = icmp ne i16 %169, 0
br i1 %170, label %171, label %179
171: ; preds = %168
%172 = load i32*, i32** %6
%173 = call signext i16 @getc(i32* %172)
%174 = load i32*, i32** %7
%175 = call i32 @putc(i16 signext %173, i32* %174)
br label %176
176: ; preds = %171
%177 = load i16, i16* %11
%178 = add i16 %177, -1
store i16 %178, i16* %11
br label %168
179: ; preds = %168
br label %180
180: ; preds = %179
%181 = load i16, i16* %10
%182 = add i16 %181, -1
store i16 %182, i16* %10
br label %162
183: ; preds = %162
%184 = load i64, i64* %8
%185 = and i64 %184, 31
%186 = trunc i64 %185 to i16
store i16 %186, i16* %10
%187 = icmp ne i16 %186, 0
br i1 %187, label %188, label %204
188: ; preds = %183
%189 = load i16, i16* %10
%190 = load i32*, i32** %7
%191 = call i32 @putc(i16 signext %189, i32* %190)
br label %192
192: ; preds = %200, %188
%193 = load i16, i16* %10
%194 = icmp ne i16 %193, 0
br i1 %194, label %195, label %203
195: ; preds = %192
%196 = load i32*, i32** %6
%197 = call signext i16 @getc(i32* %196)
%198 = load i32*, i32** %7
%199 = call i32 @putc(i16 signext %197, i32* %198)
br label %200
200: ; preds = %195
%201 = load i16, i16* %10
%202 = add i16 %201, -1
store i16 %202, i16* %10
br label %192
203: ; preds = %192
br label %204
204: ; preds = %203, %183
%205 = load i32*, i32** %6
%206 = call i32 @fclose(i32* %205)
%207 = load i32*, i32** %7
%208 = call i32 @fclose(i32* %207)
store i32 0, i32* %3
br label %209
209: ; preds = %204, %85, %60, %17
%210 = load i32, i32* %3
ret i32 %210
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [20 x i8] c"Couldn't open %s !\0A\00"
@.str.3 = [5 x i8] c".obj\00"
@.str.4 = [3 x i8] c"wb\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@str = [36 x i8] c"usage : bin2obj [-u] infile outfile\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [34 x i8]
%4 = getelementptr inbounds [34 x i8], [34 x i8]* %3, i64 0, i64 0
%5 = icmp slt i32 %0, 3
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
br label %111
8: ; preds = %2
%9 = icmp eq i32 %0, 4
br i1 %9, label %10, label %19
10: ; preds = %8
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 45
br i1 %14, label %15, label %19
15: ; preds = %10
%16 = getelementptr inbounds i8, i8* %12, i64 1
%17 = load i8, i8* %16
switch i8 %17, label %19 [
i8 117, label %18
i8 85, label %18
]
18: ; preds = %15, %15
store i8 95, i8* %4
br label %19
19: ; preds = %15, %10, %18, %8
%20 = phi i16 [ 2, %18 ], [ 1, %10 ], [ 1, %8 ], [ 1, %15 ]
%21 = zext i16 %20 to i64
%22 = getelementptr inbounds i8*, i8** %1, i64 %21
%23 = load i8*, i8** %22
%24 = tail call i32* @fopen(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %29
26: ; preds = %19
%27 = load i8*, i8** %22
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %27)
br label %111
29: ; preds = %19
%30 = add nuw nsw i16 %20, 1
%31 = zext i16 %30 to i64
%32 = getelementptr inbounds i8*, i8** %1, i64 %31
%33 = load i8*, i8** %32
%34 = call i8* @strcat(i8* %4, i8* dereferenceable(1) %33)
%35 = call i64 bitcast (i16 (i8*)* @strlen to i64 (i8*)*)(i8* %33)
%36 = getelementptr i8, i8* %33, i64 %35
%37 = call i32* @fopen(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%38 = icmp eq i32* %37, null
br i1 %38, label %39, label %42
39: ; preds = %29
%40 = load i8*, i8** %32
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %40)
br label %111
42: ; preds = %29
%43 = load i32, i32* @SEEK_END
%44 = call i32 @fseek(i32* %24, i64 0, i32 %43)
%45 = call i64 @ftell(i32* %24)
%46 = load i32, i32* @SEEK_SET
%47 = call i32 @fseek(i32* %24, i64 0, i32 %46)
%48 = add nsw i64 %45, 31
%49 = ashr i64 %48, 5
%50 = add nsw i64 %49, %45
%51 = call i32 @putc(i16 signext 253, i32* %37)
%52 = call i32 @putc(i16 signext 253, i32* %37)
%53 = call signext i16 @strlen(i8* %4)
%54 = zext i16 %53 to i32
%55 = shl i32 %54, 24
%56 = ashr exact i32 %55, 24
%57 = trunc i32 %56 to i16
%58 = add nsw i16 %57, 7
%59 = call i32 @putc(i16 signext %58, i32* %37)
%60 = call i32 @putc(i16 signext 0, i32* %37)
%61 = trunc i64 %45 to i16
%62 = and i16 %61, 255
%63 = call i32 @putc(i16 signext %62, i32* %37)
%64 = lshr i64 %45, 8
%65 = trunc i64 %64 to i16
%66 = call i32 @putc(i16 signext %65, i32* %37)
%67 = trunc i64 %50 to i16
%68 = and i16 %67, 255
%69 = call i32 @putc(i16 signext %68, i32* %37)
%70 = lshr i64 %50, 8
%71 = trunc i64 %70 to i16
%72 = call i32 @putc(i16 signext %71, i32* %37)
%73 = call i32 @putc(i16 signext 1, i32* %37)
%74 = call i32 @putc(i16 signext 0, i32* %37)
%75 = call signext i16 @strlen(i8* %4)
%76 = call i32 @putc(i16 signext %75, i32* %37)
%77 = call i32 @fputs(i8* %4, i32* %37)
%78 = call i32 @putc(i16 signext 0, i32* %37)
%79 = call i32 @putc(i16 signext 0, i32* %37)
%80 = call i32 @putc(i16 signext 7, i32* %37)
%81 = call i32 @putc(i16 signext 0, i32* %37)
%82 = lshr i64 %45, 5
%83 = trunc i64 %82 to i16
%84 = icmp eq i16 %83, 0
br i1 %84, label %97, label %85
85: ; preds = %42, %94
%86 = phi i16 [ %95, %94 ], [ %83, %42 ]
%87 = call i32 @putc(i16 signext 0, i32* %37)
br label %88
88: ; preds = %85, %88
%89 = phi i16 [ 32, %85 ], [ %92, %88 ]
%90 = call signext i16 @getc(i32* %24)
%91 = call i32 @putc(i16 signext %90, i32* %37)
%92 = add nsw i16 %89, -1
%93 = icmp eq i16 %92, 0
br i1 %93, label %94, label %88
94: ; preds = %88
%95 = add i16 %86, -1
%96 = icmp eq i16 %95, 0
br i1 %96, label %97, label %85
97: ; preds = %94, %42
%98 = and i16 %61, 31
%99 = icmp eq i16 %98, 0
br i1 %99, label %108, label %100
100: ; preds = %97
%101 = call i32 @putc(i16 signext %98, i32* %37)
br label %102
102: ; preds = %100, %102
%103 = phi i16 [ %98, %100 ], [ %106, %102 ]
%104 = call signext i16 @getc(i32* %24)
%105 = call i32 @putc(i16 signext %104, i32* %37)
%106 = add nsw i16 %103, -1
%107 = icmp eq i16 %106, 0
br i1 %107, label %108, label %102
108: ; preds = %102, %97
%109 = call i32 @fclose(i32* %24)
%110 = call i32 @fclose(i32* %37)
br label %111
111: ; preds = %108, %39, %26, %6
%112 = phi i32 [ -1, %6 ], [ -1, %26 ], [ -1, %39 ], [ 0, %108 ]
ret i32 %112
}