#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 atoi(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fileWrite32(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ fputc(int, int /*<<< orphan*/ *);
int fscanf(int /*<<< orphan*/ *, char *, int *);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  if (argc < 4) {
    fprintf(stderr,
            "usage: {input filename} {output sigfile} {signature width}\n");
    return 0;
  }
  FILE *fi;
  if ((fi = fopen(argv[1], "r"))) {
    FILE *fo = fopen(argv[2], "wb");
    int sig_width = atoi(argv[3]);
    int header_size = 6 * 4 + 64;
    int version = 2;
    int maxnamelen = 15;
    int sig_density = 0;
    int sig_seed = 0;
    char sig_method[64] = "text_to_sigfile";
    fileWrite32(header_size, fo);
    fileWrite32(version, fo);
    fileWrite32(maxnamelen, fo);
    fileWrite32(sig_width, fo);
    fileWrite32(sig_density, fo);
    fileWrite32(sig_seed, fo);
    fwrite(sig_method, 1, 64, fo);
    char filename[15 + 1];
    for (int i = 0;; i++) {
      int sig[sig_width / 8];
      int reached_eof = 0;
      for (int j = 0; j < sig_width / 8; j++) {
        int val;
        if (fscanf(fi, "%d", &val) < 1) {
          reached_eof = 1;
          break;
        }
        sig[j] = val;
      }
      if (reached_eof)
        break;
      sprintf(filename, "%d", i);
      fwrite(filename, 1, 15 + 1, fo);
      fileWrite32(0, fo);
      fileWrite32(0, fo);
      fileWrite32(0, fo);
      fileWrite32(0, fo);
      fileWrite32(0, fo);
      fileWrite32(0, fo);
      fileWrite32(0, fo);
      fileWrite32(0, fo);
      for (int j = 0; j < sig_width / 8; j++) {
        fputc(sig[j], fo);
      }
    }
    fclose(fo);
    fclose(fi);
  } else {
    fprintf(stderr, "Unable to open input file\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    11e4 <main+0x44>
mov    0x2e16(%rip),%rax
mov    (%rax),%edi
lea    0xe2d(%rip),%rsi
call   1060 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    151f <main+0x37f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe49(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1503 <main+0x363>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe29(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x24(%rbp)
movl   $0x58,-0x28(%rbp)
movl   $0x2,-0x2c(%rbp)
movl   $0xf,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
lea    -0x80(%rbp),%rdi
lea    0xe04(%rip),%rsi
mov    $0x40,%edx
call   1070 <memcpy@plt>
mov    -0x28(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1080 <fileWrite32@plt>
mov    -0x2c(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1080 <fileWrite32@plt>
mov    -0x30(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1080 <fileWrite32@plt>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1080 <fileWrite32@plt>
mov    -0x34(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1080 <fileWrite32@plt>
mov    -0x38(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1080 <fileWrite32@plt>
lea    -0x80(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x1,%esi
mov    $0x40,%edx
call   10c0 <fwrite@plt>
movl   $0x0,-0x94(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,%ecx
add    $0x7,%ecx
test   %eax,%eax
cmovs  %ecx,%eax
sar    $0x3,%eax
mov    %rsp,%rcx
mov    %rcx,-0xa0(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xc8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0xa8(%rbp)
movl   $0x0,-0xac(%rbp)
movl   $0x0,-0xb0(%rbp)
mov    -0xb0(%rbp),%eax
mov    %eax,-0xcc(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xcc(%rbp),%eax
cmp    %ecx,%eax
jge    13a1 <main+0x201>
mov    -0x18(%rbp),%rdi
lea    0xcef(%rip),%rsi
lea    -0xb4(%rbp),%rdx
call   1040 <fscanf@plt>
cmp    $0x1,%eax
jge    1376 <main+0x1d6>
movl   $0x1,-0xac(%rbp)
jmp    13a1 <main+0x201>
mov    -0xc8(%rbp),%rax
mov    -0xb4(%rbp),%edx
movslq -0xb0(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xb0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb0(%rbp)
jmp    1320 <main+0x180>
cmpl   $0x0,-0xac(%rbp)
je     13bd <main+0x21d>
movl   $0x2,-0xb8(%rbp)
jmp    14b1 <main+0x311>
lea    -0x90(%rbp),%rdi
mov    -0x94(%rbp),%edx
lea    0xc70(%rip),%rsi
call   10b0 <sprintf@plt>
lea    -0x90(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x1,%esi
mov    $0x10,%edx
call   10c0 <fwrite@plt>
mov    -0x20(%rbp),%rsi
xor    %edi,%edi
call   1080 <fileWrite32@plt>
mov    -0x20(%rbp),%rsi
xor    %edi,%edi
call   1080 <fileWrite32@plt>
mov    -0x20(%rbp),%rsi
xor    %edi,%edi
call   1080 <fileWrite32@plt>
mov    -0x20(%rbp),%rsi
xor    %edi,%edi
call   1080 <fileWrite32@plt>
mov    -0x20(%rbp),%rsi
xor    %edi,%edi
call   1080 <fileWrite32@plt>
mov    -0x20(%rbp),%rsi
xor    %edi,%edi
call   1080 <fileWrite32@plt>
mov    -0x20(%rbp),%rsi
xor    %edi,%edi
call   1080 <fileWrite32@plt>
mov    -0x20(%rbp),%rsi
xor    %edi,%edi
call   1080 <fileWrite32@plt>
movl   $0x0,-0xbc(%rbp)
mov    -0xbc(%rbp),%eax
mov    %eax,-0xd0(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xd0(%rbp),%eax
cmp    %ecx,%eax
jge    14a7 <main+0x307>
mov    -0xc8(%rbp),%rax
movslq -0xbc(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x20(%rbp),%rsi
call   1050 <fputc@plt>
mov    -0xbc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xbc(%rbp)
jmp    1452 <main+0x2b2>
movl   $0x0,-0xb8(%rbp)
mov    -0xa0(%rbp),%rax
mov    %rax,%rsp
mov    -0xb8(%rbp),%eax
test   %eax,%eax
je     14d3 <main+0x333>
jmp    14ce <main+0x32e>
jmp    14ec <main+0x34c>
jmp    14d8 <main+0x338>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    12cf <main+0x12f>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
jmp    1518 <main+0x378>
mov    0x2ad6(%rip),%rax
mov    (%rax),%edi
lea    0xb31(%rip),%rsi
call   1060 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
cmp    $0x3,%edi
jg     11be <main+0x2e>
mov    0x2e30(%rip),%rax
mov    (%rax),%edi
lea    0xe47(%rip),%rsi
jmp    147a <main+0x2ea>
mov    %rsi,%r15
mov    0x8(%rsi),%rdi
lea    0xe70(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     146a <main+0x2da>
mov    %rax,%rbx
mov    0x10(%r15),%rdi
lea    0xe56(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%r14
mov    0x18(%r15),%rdi
call   1090 <atoi@plt>
mov    %eax,%r13d
movaps 0xe8d(%rip),%xmm0
movaps %xmm0,-0x80(%rbp)
movaps 0xe72(%rip),%xmm0
movaps %xmm0,-0x90(%rbp)
movaps 0xe54(%rip),%xmm0
movaps %xmm0,-0xa0(%rbp)
movaps 0xe36(%rip),%xmm0
movaps %xmm0,-0xb0(%rbp)
mov    $0x58,%edi
mov    %r14,%rsi
call   1070 <fileWrite32@plt>
mov    $0x2,%edi
mov    %r14,%rsi
call   1070 <fileWrite32@plt>
mov    $0xf,%edi
mov    %r14,%rsi
call   1070 <fileWrite32@plt>
mov    %r13d,%edi
mov    %r14,%rsi
call   1070 <fileWrite32@plt>
xor    %eax,%eax
mov    %rax,-0x30(%rbp)
xor    %edi,%edi
mov    %r14,%rsi
call   1070 <fileWrite32@plt>
xor    %edi,%edi
mov    %r14,%rsi
call   1070 <fileWrite32@plt>
lea    -0xb0(%rbp),%rdi
mov    $0x1,%esi
mov    $0x40,%edx
mov    %r14,%rcx
call   10b0 <fwrite@plt>
lea    0x7(%r13),%r12d
test   %r13d,%r13d
cmovns %r13d,%r12d
sar    $0x3,%r12d
lea    0xf(,%r12,4),%rax
and    $0xfffffffffffffff0,%rax
mov    %rax,-0x58(%rbp)
mov    %rbx,-0x50(%rbp)
mov    %r13,-0x48(%rbp)
mov    %rsp,%rax
mov    %rsp,%r15
sub    -0x58(%rbp),%r15
mov    %r15,%rsp
cmp    $0x8,%r13d
mov    %rax,-0x40(%rbp)
jl     13c0 <main+0x230>
xor    %r13d,%r13d
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
lea    0xd57(%rip),%rsi
lea    -0x34(%rbp),%rdx
call   1040 <fscanf@plt>
test   %eax,%eax
jle    1454 <main+0x2c4>
mov    -0x34(%rbp),%eax
mov    %eax,(%r15,%r13,4)
add    $0x1,%r13
cmp    %r13,%r12
jne    12e0 <main+0x150>
lea    -0x70(%rbp),%rbx
mov    %rbx,%rdi
lea    0xd28(%rip),%rsi
mov    -0x30(%rbp),%rdx
call   10a0 <sprintf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x10,%edx
mov    %r14,%rcx
call   10b0 <fwrite@plt>
xor    %edi,%edi
mov    %r14,%rsi
call   1070 <fileWrite32@plt>
xor    %edi,%edi
mov    %r14,%rsi
call   1070 <fileWrite32@plt>
xor    %edi,%edi
mov    %r14,%rsi
call   1070 <fileWrite32@plt>
xor    %edi,%edi
mov    %r14,%rsi
call   1070 <fileWrite32@plt>
xor    %edi,%edi
mov    %r14,%rsi
call   1070 <fileWrite32@plt>
xor    %edi,%edi
mov    %r14,%rsi
call   1070 <fileWrite32@plt>
xor    %edi,%edi
mov    %r14,%rsi
call   1070 <fileWrite32@plt>
xor    %edi,%edi
mov    %r14,%rsi
call   1070 <fileWrite32@plt>
mov    -0x48(%rbp),%r13
cmp    $0x8,%r13d
jl     143c <main+0x2ac>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%edi
mov    %r14,%rsi
call   1050 <fputc@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    13a0 <main+0x210>
jmp    143c <main+0x2ac>
nopw   0x0(%rax,%rax,1)
lea    -0x70(%rbp),%rbx
mov    %rbx,%rdi
lea    0xc73(%rip),%rsi
mov    -0x30(%rbp),%rdx
call   10a0 <sprintf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x10,%edx
mov    %r14,%rcx
call   10b0 <fwrite@plt>
xor    %edi,%edi
mov    %r14,%rsi
call   1070 <fileWrite32@plt>
xor    %edi,%edi
mov    %r14,%rsi
call   1070 <fileWrite32@plt>
xor    %edi,%edi
mov    %r14,%rsi
call   1070 <fileWrite32@plt>
xor    %edi,%edi
mov    %r14,%rsi
call   1070 <fileWrite32@plt>
xor    %edi,%edi
mov    %r14,%rsi
call   1070 <fileWrite32@plt>
xor    %edi,%edi
mov    %r14,%rsi
call   1070 <fileWrite32@plt>
xor    %edi,%edi
mov    %r14,%rsi
call   1070 <fileWrite32@plt>
xor    %edi,%edi
mov    %r14,%rsi
call   1070 <fileWrite32@plt>
mov    -0x40(%rbp),%rsp
mov    -0x30(%rbp),%rax
add    $0x1,%eax
mov    %rax,-0x30(%rbp)
mov    -0x50(%rbp),%rbx
jmp    12bd <main+0x12d>
mov    -0x40(%rbp),%rsp
mov    %r14,%rdi
call   1030 <fclose@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
jmp    147f <main+0x2ef>
mov    0x2b6f(%rip),%rax
mov    (%rax),%edi
lea    0xbca(%rip),%rsi
call   1060 <fprintf@plt>
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [60 x i8] c"usage: {input filename} {output sigfile} {signature width}\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"wb\00"
@__const.main.sig_method = [64 x i8] c"text_to_sigfile\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [27 x i8] c"Unable to open input file\0A\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 i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca [64 x i8]
%15 = alloca [16 x i8]
%16 = alloca i32
%17 = alloca i8*
%18 = alloca i64
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%24 = load i32, i32* %4
%25 = icmp slt i32 %24, 4
br i1 %25, label %26, label %29
26: ; preds = %2
%27 = load i32, i32* @stderr
%28 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %149
29: ; preds = %2
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = call i32* @fopen(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %33, i32** %6
%34 = icmp ne i32* %33, null
br i1 %34, label %35, label %145
35: ; preds = %29
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 2
%38 = load i8*, i8** %37
%39 = call i32* @fopen(i8* %38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %39, i32** %7
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 3
%42 = load i8*, i8** %41
%43 = call i32 @atoi(i8* %42)
store i32 %43, i32* %8
store i32 88, i32* %9
store i32 2, i32* %10
store i32 15, i32* %11
store i32 0, i32* %12
store i32 0, i32* %13
%44 = bitcast [64 x i8]* %14 to i8*
%45 = load i32, i32* %9
%46 = load i32*, i32** %7
%47 = call i32 @fileWrite32(i32 %45, i32* %46)
%48 = load i32, i32* %10
%49 = load i32*, i32** %7
%50 = call i32 @fileWrite32(i32 %48, i32* %49)
%51 = load i32, i32* %11
%52 = load i32*, i32** %7
%53 = call i32 @fileWrite32(i32 %51, i32* %52)
%54 = load i32, i32* %8
%55 = load i32*, i32** %7
%56 = call i32 @fileWrite32(i32 %54, i32* %55)
%57 = load i32, i32* %12
%58 = load i32*, i32** %7
%59 = call i32 @fileWrite32(i32 %57, i32* %58)
%60 = load i32, i32* %13
%61 = load i32*, i32** %7
%62 = call i32 @fileWrite32(i32 %60, i32* %61)
%63 = getelementptr inbounds [64 x i8], [64 x i8]* %14, i64 0, i64 0
%64 = load i32*, i32** %7
%65 = call i32 @fwrite(i8* %63, i32 1, i32 64, i32* %64)
store i32 0, i32* %16
br label %66
66: ; preds = %137, %35
%67 = load i32, i32* %8
%68 = sdiv i32 %67, 8
%69 = zext i32 %68 to i64
%70 = call i8* @llvm.stacksave()
store i8* %70, i8** %17
%71 = alloca i32, i64 %69
store i64 %69, i64* %18
store i32 0, i32* %19
store i32 0, i32* %20
br label %72
72: ; preds = %87, %66
%73 = load i32, i32* %20
%74 = load i32, i32* %8
%75 = sdiv i32 %74, 8
%76 = icmp slt i32 %73, %75
br i1 %76, label %77, label %90
77: ; preds = %72
%78 = load i32*, i32** %6
%79 = call i32 @fscanf(i32* %78, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %21)
%80 = icmp slt i32 %79, 1
br i1 %80, label %81, label %82
81: ; preds = %77
store i32 1, i32* %19
br label %90
82: ; preds = %77
%83 = load i32, i32* %21
%84 = load i32, i32* %20
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds i32, i32* %71, i64 %85
store i32 %83, i32* %86
br label %87
87: ; preds = %82
%88 = load i32, i32* %20
%89 = add nsw i32 %88, 1
store i32 %89, i32* %20
br label %72
90: ; preds = %81, %72
%91 = load i32, i32* %19
%92 = icmp ne i32 %91, 0
br i1 %92, label %93, label %94
93: ; preds = %90
store i32 2, i32* %22
br label %133
94: ; preds = %90
%95 = getelementptr inbounds [16 x i8], [16 x i8]* %15, i64 0, i64 0
%96 = load i32, i32* %16
%97 = call i32 @sprintf(i8* %95, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %96)
%98 = getelementptr inbounds [16 x i8], [16 x i8]* %15, i64 0, i64 0
%99 = load i32*, i32** %7
%100 = call i32 @fwrite(i8* %98, i32 1, i32 16, i32* %99)
%101 = load i32*, i32** %7
%102 = call i32 @fileWrite32(i32 0, i32* %101)
%103 = load i32*, i32** %7
%104 = call i32 @fileWrite32(i32 0, i32* %103)
%105 = load i32*, i32** %7
%106 = call i32 @fileWrite32(i32 0, i32* %105)
%107 = load i32*, i32** %7
%108 = call i32 @fileWrite32(i32 0, i32* %107)
%109 = load i32*, i32** %7
%110 = call i32 @fileWrite32(i32 0, i32* %109)
%111 = load i32*, i32** %7
%112 = call i32 @fileWrite32(i32 0, i32* %111)
%113 = load i32*, i32** %7
%114 = call i32 @fileWrite32(i32 0, i32* %113)
%115 = load i32*, i32** %7
%116 = call i32 @fileWrite32(i32 0, i32* %115)
store i32 0, i32* %23
br label %117
117: ; preds = %129, %94
%118 = load i32, i32* %23
%119 = load i32, i32* %8
%120 = sdiv i32 %119, 8
%121 = icmp slt i32 %118, %120
br i1 %121, label %122, label %132
122: ; preds = %117
%123 = load i32, i32* %23
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds i32, i32* %71, i64 %124
%126 = load i32, i32* %125
%127 = load i32*, i32** %7
%128 = call i32 @fputc(i32 %126, i32* %127)
br label %129
129: ; preds = %122
%130 = load i32, i32* %23
%131 = add nsw i32 %130, 1
store i32 %131, i32* %23
br label %117
132: ; preds = %117
store i32 0, i32* %22
br label %133
133: ; preds = %132, %93
%134 = load i8*, i8** %17
%135 = load i32, i32* %22
switch i32 %135, label %151 [
i32 0, label %136
i32 2, label %140
]
136: ; preds = %133
br label %137
137: ; preds = %136
%138 = load i32, i32* %16
%139 = add nsw i32 %138, 1
store i32 %139, i32* %16
br label %66
140: ; preds = %133
%141 = load i32*, i32** %7
%142 = call i32 @fclose(i32* %141)
%143 = load i32*, i32** %6
%144 = call i32 @fclose(i32* %143)
br label %148
145: ; preds = %29
%146 = load i32, i32* @stderr
%147 = call i32 @fprintf(i32 %146, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
br label %148
148: ; preds = %145, %140
store i32 0, i32* %3
br label %149
149: ; preds = %148, %26
%150 = load i32, i32* %3
ret i32 %150
151: ; preds = %133
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [60 x i8] c"usage: {input filename} {output sigfile} {signature width}\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"wb\00"
@__const.main.sig_method = [64 x i8] c"text_to_sigfile\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [27 x i8] c"Unable to open input file\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [64 x i8]
%4 = alloca [16 x i8]
%5 = alloca i32
%6 = icmp slt i32 %0, 4
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
br label %85
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32* @fopen(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i32* %13, null
br i1 %14, label %82, label %15
15: ; preds = %10
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = tail call i32* @fopen(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%19 = getelementptr inbounds i8*, i8** %1, i64 3
%20 = load i8*, i8** %19
%21 = tail call i32 @atoi(i8* %20)
%22 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%23 = tail call i32 @fileWrite32(i32 88, i32* %18)
%24 = tail call i32 @fileWrite32(i32 2, i32* %18)
%25 = tail call i32 @fileWrite32(i32 15, i32* %18)
%26 = tail call i32 @fileWrite32(i32 %21, i32* %18)
%27 = tail call i32 @fileWrite32(i32 0, i32* %18)
%28 = tail call i32 @fileWrite32(i32 0, i32* %18)
%29 = call i32 @fwrite(i8* %22, i32 1, i32 64, i32* %18)
%30 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%31 = bitcast i32* %5 to i8*
%32 = sdiv i32 %21, 8
%33 = zext i32 %32 to i64
%34 = icmp sgt i32 %21, 7
br label %35
35: ; preds = %77, %15
%36 = phi i32 [ 0, %15 ], [ %78, %77 ]
%37 = call i8* @llvm.stacksave()
%38 = alloca i32, i64 %33
br i1 %34, label %39, label %66
39: ; preds = %35, %43
%40 = phi i64 [ %46, %43 ], [ 0, %35 ]
%41 = call i32 @fscanf(i32* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %5)
%42 = icmp slt i32 %41, 1
br i1 %42, label %79, label %43
43: ; preds = %39
%44 = load i32, i32* %5
%45 = getelementptr inbounds i32, i32* %38, i64 %40
store i32 %44, i32* %45
%46 = add nuw nsw i64 %40, 1
%47 = icmp eq i64 %46, %33
br i1 %47, label %48, label %39
48: ; preds = %43
%49 = call i32 @sprintf(i8* %30, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %36)
%50 = call i32 @fwrite(i8* %30, i32 1, i32 16, i32* %18)
%51 = call i32 @fileWrite32(i32 0, i32* %18)
%52 = call i32 @fileWrite32(i32 0, i32* %18)
%53 = call i32 @fileWrite32(i32 0, i32* %18)
%54 = call i32 @fileWrite32(i32 0, i32* %18)
%55 = call i32 @fileWrite32(i32 0, i32* %18)
%56 = call i32 @fileWrite32(i32 0, i32* %18)
%57 = call i32 @fileWrite32(i32 0, i32* %18)
%58 = call i32 @fileWrite32(i32 0, i32* %18)
br i1 %34, label %59, label %77
59: ; preds = %48, %59
%60 = phi i64 [ %64, %59 ], [ 0, %48 ]
%61 = getelementptr inbounds i32, i32* %38, i64 %60
%62 = load i32, i32* %61
%63 = call i32 @fputc(i32 %62, i32* %18)
%64 = add nuw nsw i64 %60, 1
%65 = icmp eq i64 %64, %33
br i1 %65, label %77, label %59
66: ; preds = %35
%67 = call i32 @sprintf(i8* %30, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %36)
%68 = call i32 @fwrite(i8* %30, i32 1, i32 16, i32* %18)
%69 = call i32 @fileWrite32(i32 0, i32* %18)
%70 = call i32 @fileWrite32(i32 0, i32* %18)
%71 = call i32 @fileWrite32(i32 0, i32* %18)
%72 = call i32 @fileWrite32(i32 0, i32* %18)
%73 = call i32 @fileWrite32(i32 0, i32* %18)
%74 = call i32 @fileWrite32(i32 0, i32* %18)
%75 = call i32 @fileWrite32(i32 0, i32* %18)
%76 = call i32 @fileWrite32(i32 0, i32* %18)
br label %77
77: ; preds = %59, %66, %48
%78 = add nuw nsw i32 %36, 1
br label %35
79: ; preds = %39
%80 = call i32 @fclose(i32* %18)
%81 = call i32 @fclose(i32* %13)
br label %85
82: ; preds = %10
%83 = load i32, i32* @stderr
%84 = tail call i32 @fprintf(i32 %83, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
br label %85
85: ; preds = %79, %82, %7
ret i32 0
}