#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*/ gzFile;

/* Variables and functions */
int /*<<< orphan*/ Z_NULL;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ gzclose(int /*<<< orphan*/);
int /*<<< orphan*/ gzopen(char *, char *);
scalar_t__ gzread(int /*<<< orphan*/, int *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  int i;
  if (argc == 1) {
    fprintf(stderr, "Supply icounts.gz file\n");
    return 0;
  }
  int buf[5];
  gzFile gz = Z_NULL;
  if (!((gz = gzopen(argv[1], "r")))) {
    fprintf(stderr, "problems opening file:%s\n", argv[1]);
    return 0;
  }
  while (gzread(gz, buf, sizeof(int) * 5)) {
    for (i = 0; i < 4; i++)
      fprintf(stdout, "%d\t", buf[i]);
    fprintf(stdout, "%d\n", buf[4]);
  }
  gzclose(gz);
}


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)
cmpl   $0x1,-0x8(%rbp)
jne    1183 <main+0x43>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
lea    0xe90(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    125f <main+0x11f>
mov    0x2e4e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe7a(%rip),%rsi
call   1060 <gzopen@plt>
mov    %eax,-0x34(%rbp)
cmp    $0x0,%eax
jne    11da <main+0x9a>
mov    0x2e2a(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe53(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    125f <main+0x11f>
jmp    11df <main+0x9f>
mov    -0x34(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0x14,%edx
call   1040 <gzread@plt>
cmp    $0x0,%rax
je     1257 <main+0x117>
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    1238 <main+0xf8>
mov    0x2dbe(%rip),%rax
mov    (%rax),%edi
movslq -0x14(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edx
lea    0xe11(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1201 <main+0xc1>
mov    0x2d91(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%edx
lea    0xded(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    11df <main+0x9f>
mov    -0x34(%rbp),%edi
call   1030 <gzclose@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
cmp    $0x1,%edi
jne    116d <main+0x2d>
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
lea    0xe9f(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    124e <main+0x10e>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe9d(%rip),%rsi
call   1060 <gzopen@plt>
test   %eax,%eax
je     1233 <main+0xf3>
mov    %eax,%r12d
mov    %rsp,%rsi
mov    %eax,%edi
mov    $0x14,%edx
call   1040 <gzread@plt>
test   %rax,%rax
je     1229 <main+0xe9>
mov    0x2e2e(%rip),%rbp
lea    0xe83(%rip),%rbx
lea    0xe80(%rip),%r14
mov    %rsp,%r15
nopl   0x0(%rax,%rax,1)
mov    0x0(%rbp),%edi
mov    (%rsp),%edx
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x0(%rbp),%edi
mov    0x4(%rsp),%edx
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x0(%rbp),%edi
mov    0x8(%rsp),%edx
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x0(%rbp),%edi
mov    0xc(%rsp),%edx
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x0(%rbp),%edi
mov    0x10(%rsp),%edx
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    %r12d,%edi
mov    %r15,%rsi
mov    $0x14,%edx
call   1040 <gzread@plt>
test   %rax,%rax
jne    11c0 <main+0x80>
mov    %r12d,%edi
call   1030 <gzclose@plt>
jmp    124e <main+0x10e>
mov    0x2da6(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xdd3(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"Supply icounts.gz file\0A\00"
@Z_NULL = global i32 0
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [26 x i8] c"problems opening file:%s\0A\00"
@stdout = global i32 0
@.str.3 = [4 x i8] c"%d\09\00"
@.str.4 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [5 x i32]
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %55
14: ; preds = %2
%15 = load i32, i32* @Z_NULL
store i32 %15, i32* %8
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @gzopen(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 %19, i32* %8
%20 = icmp ne i32 %19, 0
br i1 %20, label %27, label %21
21: ; preds = %14
%22 = load i32, i32* @stderr
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* %25)
store i32 0, i32* %3
br label %55
27: ; preds = %14
br label %28
28: ; preds = %47, %27
%29 = load i32, i32* %8
%30 = getelementptr inbounds [5 x i32], [5 x i32]* %7, i64 0, i64 0
%31 = call i64 @gzread(i32 %29, i32* %30, i32 20)
%32 = icmp ne i64 %31, 0
br i1 %32, label %33, label %52
33: ; preds = %28
store i32 0, i32* %6
br label %34
34: ; preds = %44, %33
%35 = load i32, i32* %6
%36 = icmp slt i32 %35, 4
br i1 %36, label %37, label %47
37: ; preds = %34
%38 = load i32, i32* @stdout
%39 = load i32, i32* %6
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [5 x i32], [5 x i32]* %7, i64 0, i64 %40
%42 = load i32, i32* %41
%43 = call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %42)
br label %44
44: ; preds = %37
%45 = load i32, i32* %6
%46 = add nsw i32 %45, 1
store i32 %46, i32* %6
br label %34
47: ; preds = %34
%48 = load i32, i32* @stdout
%49 = getelementptr inbounds [5 x i32], [5 x i32]* %7, i64 0, i64 4
%50 = load i32, i32* %49
%51 = call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %50)
br label %28
52: ; preds = %28
%53 = load i32, i32* %8
%54 = call i32 @gzclose(i32 %53)
br label %55
55: ; preds = %52, %21, %11
%56 = load i32, i32* %3
ret i32 %56
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"Supply icounts.gz file\0A\00"
@Z_NULL = global i32 0
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [26 x i8] c"problems opening file:%s\0A\00"
@stdout = global i32 0
@.str.3 = [4 x i8] c"%d\09\00"
@.str.4 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [5 x i32]
%4 = icmp eq i32 %0, 1
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %48
8: ; preds = %2
%9 = bitcast [5 x i32]* %3 to i8*
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @gzopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
br i1 %13, label %23, label %14
14: ; preds = %8
%15 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%16 = call i64 @gzread(i32 %12, i32* %15, i32 20)
%17 = icmp eq i64 %16, 0
br i1 %17, label %45, label %18
18: ; preds = %14
%19 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 4
%20 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 1
%21 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 2
%22 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 3
br label %27
23: ; preds = %8
%24 = load i32, i32* @stderr
%25 = load i8*, i8** %10
%26 = tail call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* %25)
br label %47
27: ; preds = %18, %27
%28 = load i32, i32* @stdout
%29 = load i32, i32* %15
%30 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %29)
%31 = load i32, i32* @stdout
%32 = load i32, i32* %20
%33 = call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %32)
%34 = load i32, i32* @stdout
%35 = load i32, i32* %21
%36 = call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %35)
%37 = load i32, i32* @stdout
%38 = load i32, i32* %22
%39 = call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %38)
%40 = load i32, i32* @stdout
%41 = load i32, i32* %19
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %41)
%43 = call i64 @gzread(i32 %12, i32* %15, i32 20)
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %27
45: ; preds = %27, %14
%46 = call i32 @gzclose(i32 %12)
br label %47
47: ; preds = %45, %23
br label %48
48: ; preds = %47, %5
ret i32 0
}