#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*/ exit(int);
int /*<<< orphan*/ extractsnd(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int flxx_numitems(int /*<<< orphan*/ *);
int /*<<< orphan*/ *flxx_open(char *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int getopt(int, char **, char *);
int /*<<< orphan*/ indexsnd(int /*<<< orphan*/ *, int, int /*<<< orphan*/ *);
char *optarg;
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ sscanf(char *, char *, int *, int *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
int /*<<< orphan*/ usage(char *);
int main(int argc, char *argv[]) {
  FILE *fin, *findex;
  char indexname[256], sndname[256];
  int ch, i, maxitem, min = -1, max = -1, makeindex = 0;
  sndname[0] = '\0';
  while ((ch = getopt(argc, argv, "r:if:")) != -1)
    switch (ch) {
    case 'i':
      makeindex = 1;
      break;
    case 'r':
      sscanf(optarg, "%i-%i", &min, &max);
      break;
    case 'f':
      strcpy(sndname, optarg);
      break;
    default:
      usage(argv[0]);
      break;
    }
  if (strlen(sndname) == 0)
    usage(argv[0]);
  fin = flxx_open(sndname);
  if (fin == NULL) {
    fprintf(stderr, "couldn't open %s\n", sndname);
    exit(-1);
  }
  if (makeindex) {
    strcpy(indexname, sndname);
    strcat(indexname, ".txt");
    findex = fopen(indexname, "wt");
    if (findex == NULL) {
      fprintf(stderr, "couldn't create %s\n", indexname);
      exit(-1);
    }
    fprintf(findex, "   id   type   description\n");
    fprintf(findex, "---------------------------------------------------\n");
  }
  maxitem = flxx_numitems(fin) - 1;
  if (min == -1)
    min = 0;
  if (max == -1)
    max = maxitem;
  if (min < 0)
    min = 0;
  else if (min > maxitem)
    min = maxitem;
  if (max < min)
    max = min;
  else if (max > maxitem)
    max = maxitem;
  for (i = min; i <= max; i++) {
    if (makeindex)
      indexsnd(fin, i, findex);
    else {
      printf("Extracting %i/%i\n", i - min + 1, max - min + 1);
      extractsnd(fin, i);
    }
  }
  fclose(fin);
  if (makeindex)
    fclose(findex);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x240,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x230(%rbp)
ff ff ff
movl   $0xffffffff,-0x234(%rbp)
ff ff ff
movl   $0x0,-0x238(%rbp)
movb   $0x0,-0x220(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xdc4(%rip),%rdx
call   10f0 <getopt@plt>
mov    %eax,-0x224(%rbp)
cmp    $0xffffffff,%eax
je     12f6 <main+0x106>
mov    -0x224(%rbp),%eax
mov    %eax,-0x23c(%rbp)
sub    $0x66,%eax
je     12ca <main+0xda>
jmp    126a <main+0x7a>
mov    -0x23c(%rbp),%eax
sub    $0x69,%eax
je     1292 <main+0xa2>
jmp    127e <main+0x8e>
mov    -0x23c(%rbp),%eax
sub    $0x72,%eax
je     12a1 <main+0xb1>
jmp    12e5 <main+0xf5>
movl   $0x1,-0x238(%rbp)
jmp    12f1 <main+0x101>
mov    0x2d50(%rip),%rax
mov    (%rax),%rdi
lea    0xd54(%rip),%rsi
lea    -0x230(%rbp),%rdx
lea    -0x234(%rbp),%rcx
call   10a0 <sscanf@plt>
jmp    12f1 <main+0x101>
lea    -0x220(%rbp),%rdi
mov    0x2d20(%rip),%rax
mov    (%rax),%rsi
call   1030 <strcpy@plt>
jmp    12f1 <main+0x101>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10b0 <usage@plt>
jmp    122e <main+0x3e>
lea    -0x220(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x0,%rax
jne    1318 <main+0x128>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10b0 <usage@plt>
lea    -0x220(%rbp),%rdi
call   10e0 <flxx_open@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    135c <main+0x16c>
mov    0x2c9e(%rip),%rax
movslq (%rax),%rdi
lea    -0x220(%rbp),%rdx
lea    0xcc1(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0xffffffff,%edi
call   1110 <exit@plt>
cmpl   $0x0,-0x238(%rbp)
je     13fe <main+0x20e>
lea    -0x120(%rbp),%rdi
lea    -0x220(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x120(%rbp),%rdi
lea    0xc94(%rip),%rsi
call   1100 <strcat@plt>
lea    -0x120(%rbp),%rdi
lea    0xc86(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    13da <main+0x1ea>
mov    0x2c20(%rip),%rax
movslq (%rax),%rdi
lea    -0x120(%rbp),%rdx
lea    0xc5d(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0xffffffff,%edi
call   1110 <exit@plt>
mov    -0x20(%rbp),%rdi
lea    0xc55(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xc5f(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   10c0 <flxx_numitems@plt>
sub    $0x1,%eax
mov    %eax,-0x22c(%rbp)
cmpl   $0xffffffff,-0x230(%rbp)
jne    1427 <main+0x237>
movl   $0x0,-0x230(%rbp)
cmpl   $0xffffffff,-0x234(%rbp)
jne    1440 <main+0x250>
mov    -0x22c(%rbp),%eax
mov    %eax,-0x234(%rbp)
cmpl   $0x0,-0x230(%rbp)
jge    145c <main+0x26c>
movl   $0x0,-0x230(%rbp)
jmp    147f <main+0x28f>
mov    -0x230(%rbp),%eax
cmp    -0x22c(%rbp),%eax
jle    147a <main+0x28a>
mov    -0x22c(%rbp),%eax
mov    %eax,-0x230(%rbp)
jmp    147f <main+0x28f>
mov    -0x234(%rbp),%eax
cmp    -0x230(%rbp),%eax
jge    14a2 <main+0x2b2>
mov    -0x230(%rbp),%eax
mov    %eax,-0x234(%rbp)
jmp    14c5 <main+0x2d5>
mov    -0x234(%rbp),%eax
cmp    -0x22c(%rbp),%eax
jle    14c0 <main+0x2d0>
mov    -0x22c(%rbp),%eax
mov    %eax,-0x234(%rbp)
jmp    14c5 <main+0x2d5>
mov    -0x230(%rbp),%eax
mov    %eax,-0x228(%rbp)
mov    -0x228(%rbp),%eax
cmp    -0x234(%rbp),%eax
jg     155a <main+0x36a>
cmpl   $0x0,-0x238(%rbp)
je     1508 <main+0x318>
mov    -0x18(%rbp),%rdi
mov    -0x228(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1080 <indexsnd@plt>
jmp    1541 <main+0x351>
mov    -0x228(%rbp),%esi
sub    -0x230(%rbp),%esi
add    $0x1,%esi
mov    -0x234(%rbp),%edx
sub    -0x230(%rbp),%edx
add    $0x1,%edx
lea    0xb5e(%rip),%rdi
call   1070 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x228(%rbp),%esi
call   1060 <extractsnd@plt>
jmp    1546 <main+0x356>
mov    -0x228(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x228(%rbp)
jmp    14d1 <main+0x2e1>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
cmpl   $0x0,-0x238(%rbp)
je     1579 <main+0x389>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x240,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x218,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
movl   $0xffffffff,0x8(%rsp)
ff
movl   $0xffffffff,0x4(%rsp)
ff
movb   $0x0,0x10(%rsp)
mov    $0x1,%al
mov    %eax,0xc(%rsp)
lea    0xdd8(%rip),%r14
mov    0x2dc9(%rip),%r12
lea    0x8(%rsp),%r13
lea    0x4(%rsp),%r15
jmp    1253 <main+0x63>
nopl   0x0(%rax,%rax,1)
cmp    $0x66,%eax
jne    1282 <main+0x92>
mov    (%r12),%rsi
lea    0x10(%rsp),%rdi
call   1030 <strcpy@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   10e0 <getopt@plt>
cmp    $0x68,%eax
jle    1240 <main+0x50>
cmp    $0x72,%eax
jne    1289 <main+0x99>
mov    (%r12),%rdi
lea    0xd91(%rip),%rsi
mov    %r13,%rdx
mov    %r15,%rcx
call   1090 <sscanf@plt>
jmp    1253 <main+0x63>
cmp    $0xffffffff,%eax
jne    128e <main+0x9e>
jmp    12a2 <main+0xb2>
cmp    $0x69,%eax
je     1298 <main+0xa8>
mov    (%rbx),%rdi
call   10a0 <usage@plt>
jmp    1253 <main+0x63>
movl   $0x0,0xc(%rsp)
jmp    1253 <main+0x63>
cmpb   $0x0,0x10(%rsp)
jne    12b1 <main+0xc1>
mov    (%rbx),%rdi
call   10a0 <usage@plt>
lea    0x10(%rsp),%rdi
call   10d0 <flxx_open@plt>
test   %rax,%rax
mov    0xc(%rsp),%r13d
je     1424 <main+0x234>
mov    %rax,%r15
test   $0x1,%r13b
jne    1343 <main+0x153>
lea    0x110(%rsp),%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xd30(%rip),%rsi
mov    %rbx,%rdi
call   10f0 <strcat@plt>
lea    0xd26(%rip),%rsi
mov    %rbx,%rdi
call   10c0 <fopen@plt>
test   %rax,%rax
je     143c <main+0x24c>
mov    %rax,%r14
lea    0xd22(%rip),%rdi
mov    $0x1b,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1110 <fwrite@plt>
lea    0xd25(%rip),%rdi
mov    $0x34,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1110 <fwrite@plt>
mov    %r15,%rdi
call   10b0 <flxx_numitems@plt>
mov    0x8(%rsp),%ebx
cmp    $0xffffffff,%ebx
jne    135e <main+0x16e>
movl   $0x0,0x8(%rsp)
xor    %ebx,%ebx
lea    -0x1(%rax),%ecx
mov    0x4(%rsp),%edx
cmp    $0xffffffff,%edx
je     1384 <main+0x194>
test   %ebx,%ebx
js     138e <main+0x19e>
cmp    %eax,%ebx
jl     1378 <main+0x188>
mov    %ecx,0x8(%rsp)
mov    %ecx,%ebx
cmp    %ebx,%edx
jge    139c <main+0x1ac>
mov    %ebx,0x4(%rsp)
mov    %ebx,%edx
jmp    13a6 <main+0x1b6>
mov    %ecx,0x4(%rsp)
mov    %ecx,%edx
test   %ebx,%ebx
jns    136e <main+0x17e>
movl   $0x0,0x8(%rsp)
xor    %ebx,%ebx
cmp    %ebx,%edx
jl     137c <main+0x18c>
cmp    %eax,%edx
jl     13a6 <main+0x1b6>
mov    %ecx,0x4(%rsp)
mov    %ecx,%edx
cmp    %edx,%ebx
jle    13d4 <main+0x1e4>
mov    %r15,%rdi
call   1040 <fclose@plt>
test   $0x1,%r13b
jne    13c0 <main+0x1d0>
mov    %r14,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x218,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xcb0(%rip),%r12
jmp    140c <main+0x21c>
nopl   (%rax)
mov    0x8(%rsp),%eax
lea    0x1(%rbx),%ebp
mov    %ebp,%esi
sub    %eax,%esi
sub    %eax,%edx
add    $0x1,%edx
mov    %r12,%rdi
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %ebx,%esi
call   1050 <extractsnd@plt>
mov    0x4(%rsp),%edx
cmp    %edx,%ebx
mov    %ebp,%ebx
jge    13aa <main+0x1ba>
test   $0x1,%r13b
jne    13e0 <main+0x1f0>
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r14,%rdx
call   1070 <indexsnd@plt>
lea    0x1(%rbx),%ebp
jmp    1402 <main+0x212>
mov    0x2bad(%rip),%rax
movslq (%rax),%rdi
lea    0xbd7(%rip),%rsi
lea    0x10(%rsp),%rdx
jmp    1455 <main+0x265>
mov    0x2b95(%rip),%rax
movslq (%rax),%rdi
lea    0xbd9(%rip),%rsi
lea    0x110(%rsp),%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0xffffffff,%edi
call   1100 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"r:if:\00"
@optarg = global i8* null
@.str.1 = [6 x i8] c"%i-%i\00"
@stderr = global i32 0
@.str.2 = [18 x i8] c"couldn't open %s\0A\00"
@.str.3 = [5 x i8] c".txt\00"
@.str.4 = [3 x i8] c"wt\00"
@.str.5 = [20 x i8] c"couldn't create %s\0A\00"
@.str.6 = [28 x i8] c" id type description\0A\00"
@.str.7 = [53 x i8] c"---------------------------------------------------\0A\00"
@.str.8 = [18 x i8] c"Extracting %i/%i\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 [256 x i8]
%9 = alloca [256 x i8]
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 -1, i32* %13
store i32 -1, i32* %14
store i32 0, i32* %15
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
store i8 0, i8* %16
br label %17
17: ; preds = %37, %2
%18 = load i32, i32* %4
%19 = load i8**, i8*** %5
%20 = call i32 @getopt(i32 %18, i8** %19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 %20, i32* %10
%21 = icmp ne i32 %20, -1
br i1 %21, label %22, label %38
22: ; preds = %17
%23 = load i32, i32* %10
switch i32 %23, label %32 [
i32 105, label %24
i32 114, label %25
i32 102, label %28
]
24: ; preds = %22
store i32 1, i32* %15
br label %37
25: ; preds = %22
%26 = load i8*, i8** @optarg
%27 = call i32 @sscanf(i8* %26, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %13, i32* %14)
br label %37
28: ; preds = %22
%29 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%30 = load i8*, i8** @optarg
%31 = call i32 @strcpy(i8* %29, i8* %30)
br label %37
32: ; preds = %22
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 0
%35 = load i8*, i8** %34
%36 = call i32 @usage(i8* %35)
br label %37
37: ; preds = %32, %28, %25, %24
br label %17
38: ; preds = %17
%39 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%40 = call i64 @strlen(i8* %39)
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %47
42: ; preds = %38
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 0
%45 = load i8*, i8** %44
%46 = call i32 @usage(i8* %45)
br label %47
47: ; preds = %42, %38
%48 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%49 = call i32* @flxx_open(i8* %48)
store i32* %49, i32** %6
%50 = load i32*, i32** %6
%51 = icmp eq i32* %50, null
br i1 %51, label %52, label %59
52: ; preds = %47
%53 = load i32, i32* @stderr
%54 = sext i32 %53 to i64
%55 = inttoptr i64 %54 to i32*
%56 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%57 = call i32 (i32*, i8*, ...) @fprintf(i32* %55, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %56)
%58 = call i32 @exit(i32 -1)
unreachable
59: ; preds = %47
%60 = load i32, i32* %15
%61 = icmp ne i32 %60, 0
br i1 %61, label %62, label %84
62: ; preds = %59
%63 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%64 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%65 = call i32 @strcpy(i8* %63, i8* %64)
%66 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%67 = call i32 @strcat(i8* %66, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%68 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%69 = call i32* @fopen(i8* %68, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32* %69, i32** %7
%70 = load i32*, i32** %7
%71 = icmp eq i32* %70, null
br i1 %71, label %72, label %79
72: ; preds = %62
%73 = load i32, i32* @stderr
%74 = sext i32 %73 to i64
%75 = inttoptr i64 %74 to i32*
%76 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%77 = call i32 (i32*, i8*, ...) @fprintf(i32* %75, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i8* %76)
%78 = call i32 @exit(i32 -1)
unreachable
79: ; preds = %62
%80 = load i32*, i32** %7
%81 = call i32 (i32*, i8*, ...) @fprintf(i32* %80, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
%82 = load i32*, i32** %7
%83 = call i32 (i32*, i8*, ...) @fprintf(i32* %82, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.7, i64 0, i64 0))
br label %84
84: ; preds = %79, %59
%85 = load i32*, i32** %6
%86 = call i32 @flxx_numitems(i32* %85)
%87 = sub nsw i32 %86, 1
store i32 %87, i32* %12
%88 = load i32, i32* %13
%89 = icmp eq i32 %88, -1
br i1 %89, label %90, label %91
90: ; preds = %84
store i32 0, i32* %13
br label %91
91: ; preds = %90, %84
%92 = load i32, i32* %14
%93 = icmp eq i32 %92, -1
br i1 %93, label %94, label %96
94: ; preds = %91
%95 = load i32, i32* %12
store i32 %95, i32* %14
br label %96
96: ; preds = %94, %91
%97 = load i32, i32* %13
%98 = icmp slt i32 %97, 0
br i1 %98, label %99, label %100
99: ; preds = %96
store i32 0, i32* %13
br label %107
100: ; preds = %96
%101 = load i32, i32* %13
%102 = load i32, i32* %12
%103 = icmp sgt i32 %101, %102
br i1 %103, label %104, label %106
104: ; preds = %100
%105 = load i32, i32* %12
store i32 %105, i32* %13
br label %106
106: ; preds = %104, %100
br label %107
107: ; preds = %106, %99
%108 = load i32, i32* %14
%109 = load i32, i32* %13
%110 = icmp slt i32 %108, %109
br i1 %110, label %111, label %113
111: ; preds = %107
%112 = load i32, i32* %13
store i32 %112, i32* %14
br label %120
113: ; preds = %107
%114 = load i32, i32* %14
%115 = load i32, i32* %12
%116 = icmp sgt i32 %114, %115
br i1 %116, label %117, label %119
117: ; preds = %113
%118 = load i32, i32* %12
store i32 %118, i32* %14
br label %119
119: ; preds = %117, %113
br label %120
120: ; preds = %119, %111
%121 = load i32, i32* %13
store i32 %121, i32* %11
br label %122
122: ; preds = %148, %120
%123 = load i32, i32* %11
%124 = load i32, i32* %14
%125 = icmp sle i32 %123, %124
br i1 %125, label %126, label %151
126: ; preds = %122
%127 = load i32, i32* %15
%128 = icmp ne i32 %127, 0
br i1 %128, label %129, label %134
129: ; preds = %126
%130 = load i32*, i32** %6
%131 = load i32, i32* %11
%132 = load i32*, i32** %7
%133 = call i32 @indexsnd(i32* %130, i32 %131, i32* %132)
br label %147
134: ; preds = %126
%135 = load i32, i32* %11
%136 = load i32, i32* %13
%137 = sub nsw i32 %135, %136
%138 = add nsw i32 %137, 1
%139 = load i32, i32* %14
%140 = load i32, i32* %13
%141 = sub nsw i32 %139, %140
%142 = add nsw i32 %141, 1
%143 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), i32 %138, i32 %142)
%144 = load i32*, i32** %6
%145 = load i32, i32* %11
%146 = call i32 @extractsnd(i32* %144, i32 %145)
br label %147
147: ; preds = %134, %129
br label %148
148: ; preds = %147
%149 = load i32, i32* %11
%150 = add nsw i32 %149, 1
store i32 %150, i32* %11
br label %122
151: ; preds = %122
%152 = load i32*, i32** %6
%153 = call i32 @fclose(i32* %152)
%154 = load i32, i32* %15
%155 = icmp ne i32 %154, 0
br i1 %155, label %156, label %159
156: ; preds = %151
%157 = load i32*, i32** %7
%158 = call i32 @fclose(i32* %157)
br label %159
159: ; preds = %156, %151
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"r:if:\00"
@optarg = global i8* null
@.str.1 = [6 x i8] c"%i-%i\00"
@stderr = global i32 0
@.str.2 = [18 x i8] c"couldn't open %s\0A\00"
@.str.3 = [5 x i8] c".txt\00"
@.str.4 = [3 x i8] c"wt\00"
@.str.5 = [20 x i8] c"couldn't create %s\0A\00"
@.str.6 = [28 x i8] c" id type description\0A\00"
@.str.7 = [53 x i8] c"---------------------------------------------------\0A\00"
@.str.8 = [18 x i8] c"Extracting %i/%i\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [256 x i8]
%4 = alloca [256 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%9 = bitcast i32* %5 to i8*
store i32 -1, i32* %5
%10 = bitcast i32* %6 to i8*
store i32 -1, i32* %6
store i8 0, i8* %8
br label %11
11: ; preds = %13, %2
%12 = phi i1 [ true, %2 ], [ false, %13 ]
br label %13
13: ; preds = %24, %11
%14 = call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
switch i32 %14, label %21 [
i32 -1, label %25
i32 105, label %11
i32 114, label %15
i32 102, label %18
]
15: ; preds = %13
%16 = load i8*, i8** @optarg
%17 = call i32 @sscanf(i8* %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %5, i32* %6)
br label %24
18: ; preds = %13
%19 = load i8*, i8** @optarg
%20 = call i32 @strcpy(i8* %8, i8* %19)
br label %24
21: ; preds = %13
%22 = load i8*, i8** %1
%23 = call i32 @usage(i8* %22)
br label %24
24: ; preds = %21, %18, %15
br label %13
25: ; preds = %13
%26 = load i8, i8* %8
%27 = icmp eq i8 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = load i8*, i8** %1
%30 = call i32 @usage(i8* %29)
br label %31
31: ; preds = %28, %25
%32 = call i32* @flxx_open(i8* %8)
%33 = icmp eq i32* %32, null
br i1 %33, label %34, label %40
34: ; preds = %31
%35 = load i32, i32* @stderr
%36 = sext i32 %35 to i64
%37 = inttoptr i64 %36 to i32*
%38 = call i32 (i32*, i8*, ...) @fprintf(i32* %37, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %8)
%39 = call i32 @exit(i32 -1)
unreachable
40: ; preds = %31
br i1 %12, label %55, label %41
41: ; preds = %40
%42 = call i32 @strcpy(i8* %7, i8* %8)
%43 = call i32 @strcat(i8* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%44 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%45 = icmp eq i32* %44, null
br i1 %45, label %46, label %52
46: ; preds = %41
%47 = load i32, i32* @stderr
%48 = sext i32 %47 to i64
%49 = inttoptr i64 %48 to i32*
%50 = call i32 (i32*, i8*, ...) @fprintf(i32* %49, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i8* %7)
%51 = call i32 @exit(i32 -1)
unreachable
52: ; preds = %41
%53 = call i64 @fwrite(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i64 27, i64 1, i32* %44)
%54 = call i64 @fwrite(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.7, i64 0, i64 0), i64 52, i64 1, i32* %44)
br label %55
55: ; preds = %52, %40
%56 = phi i32* [ %44, %52 ], [ undef, %40 ]
%57 = call i32 @flxx_numitems(i32* %32)
%58 = add nsw i32 %57, -1
%59 = load i32, i32* %5
%60 = icmp eq i32 %59, -1
br i1 %60, label %61, label %62
61: ; preds = %55
store i32 0, i32* %5
br label %62
62: ; preds = %61, %55
%63 = phi i32 [ 0, %61 ], [ %59, %55 ]
%64 = load i32, i32* %6
%65 = icmp eq i32 %64, -1
br i1 %65, label %66, label %67
66: ; preds = %62
store i32 %58, i32* %6
br label %67
67: ; preds = %66, %62
%68 = phi i32 [ %58, %66 ], [ %64, %62 ]
%69 = icmp slt i32 %63, 0
br i1 %69, label %70, label %71
70: ; preds = %67
store i32 0, i32* %5
br label %74
71: ; preds = %67
%72 = icmp slt i32 %63, %57
br i1 %72, label %74, label %73
73: ; preds = %71
store i32 %58, i32* %5
br label %74
74: ; preds = %71, %73, %70
%75 = phi i32 [ %63, %71 ], [ %58, %73 ], [ 0, %70 ]
%76 = icmp slt i32 %68, %75
br i1 %76, label %77, label %78
77: ; preds = %74
store i32 %75, i32* %6
br label %81
78: ; preds = %74
%79 = icmp slt i32 %68, %57
br i1 %79, label %81, label %80
80: ; preds = %78
store i32 %58, i32* %6
br label %81
81: ; preds = %78, %80, %77
%82 = phi i32 [ %68, %78 ], [ %58, %80 ], [ %75, %77 ]
%83 = icmp sgt i32 %75, %82
br i1 %83, label %102, label %84
84: ; preds = %81, %98
%85 = phi i32 [ %100, %98 ], [ %82, %81 ]
%86 = phi i32 [ %99, %98 ], [ %75, %81 ]
br i1 %12, label %90, label %87
87: ; preds = %84
%88 = call i32 @indexsnd(i32* %32, i32 %86, i32* %56)
%89 = add nsw i32 %86, 1
br label %98
90: ; preds = %84
%91 = load i32, i32* %5
%92 = add i32 %86, 1
%93 = sub i32 %92, %91
%94 = add i32 %85, 1
%95 = sub i32 %94, %91
%96 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), i32 %93, i32 %95)
%97 = call i32 @extractsnd(i32* %32, i32 %86)
br label %98
98: ; preds = %87, %90
%99 = phi i32 [ %89, %87 ], [ %92, %90 ]
%100 = load i32, i32* %6
%101 = icmp slt i32 %86, %100
br i1 %101, label %84, label %102
102: ; preds = %98, %81
%103 = call i32 @fclose(i32* %32)
br i1 %12, label %106, label %104
104: ; preds = %102
%105 = call i32 @fclose(i32* %56)
br label %106
106: ; preds = %104, %102
ret i32 0
}