#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*/ atoi(char *);
int /*<<< orphan*/ errx(int, char *, char *);
int /*<<< orphan*/ extract_blocks(int /*<<< orphan*/ *, char *,
                                  int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int main(int argc, char **argv) {
  int i = 1;
  FILE *infile;
  if ((infile = fopen(argv[1], "r")) == NULL)
    errx(1, "cannot read `%s'", argv[1]);
  for (i = 2; i < (argc - 2); i += 3)
    extract_blocks(infile, argv[i], atoi(argv[i + 1]), atoi(argv[i + 2]));
  fclose(infile);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe84(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    11a8 <main+0x58>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    $0x1,%edi
lea    0xe5f(%rip),%rsi
call   1040 <errx@plt>
movl   $0x2,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jge    1227 <main+0xd7>
mov    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1070 <atoi@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x24(%rbp),%edx
mov    %eax,%ecx
call   1050 <extract_blocks@plt>
mov    -0x14(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x14(%rbp)
jmp    11af <main+0x5f>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r12
mov    %edi,%r14d
mov    0x8(%rsi),%rdi
lea    0xe94(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%r15
test   %rax,%rax
je     1181 <main+0x31>
cmp    $0x5,%r14d
jge    119d <main+0x4d>
jmp    11e2 <main+0x92>
mov    0x8(%r12),%rdx
lea    0xe75(%rip),%rsi
mov    $0x1,%edi
call   1040 <errx@plt>
cmp    $0x5,%r14d
jl     11e2 <main+0x92>
add    $0xfffffffe,%r14d
mov    $0x2,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    (%r12,%rbp,8),%r13
mov    0x8(%r12,%rbp,8),%rdi
call   1070 <atoi@plt>
mov    %eax,%ebx
mov    0x10(%r12,%rbp,8),%rdi
call   1070 <atoi@plt>
mov    %r15,%rdi
mov    %r13,%rsi
mov    %ebx,%edx
mov    %eax,%ecx
call   1050 <extract_blocks@plt>
add    $0x3,%rbp
cmp    %ebp,%r14d
jg     11b0 <main+0x60>
mov    %r15,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [17 x i8] c"cannot read `%s'\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %11, i32** %7
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @errx(i32 1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %16)
br label %18
18: ; preds = %13, %2
store i32 2, i32* %6
br label %19
19: ; preds = %46, %18
%20 = load i32, i32* %6
%21 = load i32, i32* %4
%22 = sub nsw i32 %21, 2
%23 = icmp slt i32 %20, %22
br i1 %23, label %24, label %49
24: ; preds = %19
%25 = load i32*, i32** %7
%26 = load i8**, i8*** %5
%27 = load i32, i32* %6
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8*, i8** %26, i64 %28
%30 = load i8*, i8** %29
%31 = load i8**, i8*** %5
%32 = load i32, i32* %6
%33 = add nsw i32 %32, 1
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8*, i8** %31, i64 %34
%36 = load i8*, i8** %35
%37 = call i32 @atoi(i8* %36)
%38 = load i8**, i8*** %5
%39 = load i32, i32* %6
%40 = add nsw i32 %39, 2
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8*, i8** %38, i64 %41
%43 = load i8*, i8** %42
%44 = call i32 @atoi(i8* %43)
%45 = call i32 @extract_blocks(i32* %25, i8* %30, i32 %37, i32 %44)
br label %46
46: ; preds = %24
%47 = load i32, i32* %6
%48 = add nsw i32 %47, 3
store i32 %48, i32* %6
br label %19
49: ; preds = %19
%50 = load i32*, i32** %7
%51 = call i32 @fclose(i32* %50)
%52 = load i32, i32* %3
ret i32 %52
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [17 x i8] c"cannot read `%s'\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32* @fopen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = tail call i32 @errx(i32 1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %8)
br label %10
10: ; preds = %7, %2
%11 = add nsw i32 %0, -2
%12 = icmp sgt i32 %0, 4
br i1 %12, label %13, label %29
13: ; preds = %10, %13
%14 = phi i64 [ %26, %13 ], [ 2, %10 ]
%15 = getelementptr inbounds i8*, i8** %1, i64 %14
%16 = load i8*, i8** %15
%17 = add nuw nsw i64 %14, 1
%18 = getelementptr inbounds i8*, i8** %1, i64 %17
%19 = load i8*, i8** %18
%20 = tail call i32 @atoi(i8* %19)
%21 = add nuw nsw i64 %14, 2
%22 = getelementptr inbounds i8*, i8** %1, i64 %21
%23 = load i8*, i8** %22
%24 = tail call i32 @atoi(i8* %23)
%25 = tail call i32 @extract_blocks(i32* %5, i8* %16, i32 %20, i32 %24)
%26 = add nuw i64 %14, 3
%27 = trunc i64 %26 to i32
%28 = icmp sgt i32 %11, %27
br i1 %28, label %13, label %29
29: ; preds = %13, %10
%30 = tail call i32 @fclose(i32* %5)
ret i32 0
}