#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*/ fatal_error(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ push_ps(int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ stderr;
FILE *gunzip(char *fn, char *mode) {
  FILE *fp;
  char buf[256];
  sprintf(buf, "gunzip -c < %s", fn);
  fprintf(stderr, "Going to execute '%s'\n", buf);
  if ((fp = popen(buf, mode)) == NULL)
    fatal_error(0, "Could not open %s", fn);
  push_ps(fp);
  return fp;
}


x86 assembly (clang, -O0):
<gunzip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x120(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe8b(%rip),%rsi
call   1070 <sprintf@plt>
mov    0x2e5f(%rip),%rax
mov    (%rax),%edi
lea    -0x120(%rbp),%rdx
lea    0xe7e(%rip),%rsi
call   1040 <fprintf@plt>
lea    -0x120(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <popen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    11c6 <gunzip+0x76>
mov    -0x8(%rbp),%rdx
xor    %edi,%edi
lea    0xe65(%rip),%rsi
call   1050 <fatal_error@plt>
mov    -0x18(%rbp),%rdi
call   1030 <push_ps@plt>
mov    -0x18(%rbp),%rax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gunzip>:
push   %r15
push   %r14
push   %rbx
sub    $0x100,%rsp
mov    %rsi,%r15
mov    %rdi,%r14
lea    0xe97(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rdx
call   1070 <sprintf@plt>
mov    0x2e62(%rip),%rax
mov    (%rax),%edi
lea    0xe88(%rip),%rsi
mov    %rbx,%rdx
call   1040 <fprintf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <popen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    11b3 <gunzip+0x63>
lea    0xe7d(%rip),%rsi
xor    %edi,%edi
mov    %r14,%rdx
call   1050 <fatal_error@plt>
mov    %rbx,%rdi
call   1030 <push_ps@plt>
mov    %rbx,%rax
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [15 x i8] c"gunzip -c < %s\00"
@stderr = global i32 0
@.str.1 = [23 x i8] c"Going to execute '%s'\0A\00"
@.str.2 = [18 x i8] c"Could not open %s\00"
define i32* @gunzip(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca [256 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%8 = load i8*, i8** %3
%9 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = load i32, i32* @stderr
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%12 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%14 = load i8*, i8** %4
%15 = call i32* @popen(i8* %13, i8* %14)
store i32* %15, i32** %5
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %20
17: ; preds = %2
%18 = load i8*, i8** %3
%19 = call i32 @fatal_error(i32 0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %18)
br label %20
20: ; preds = %17, %2
%21 = load i32*, i32** %5
%22 = call i32 @push_ps(i32* %21)
%23 = load i32*, i32** %5
ret i32* %23
}

LLVM IR (-O2):
@.str = [15 x i8] c"gunzip -c < %s\00"
@stderr = global i32 0
@.str.1 = [23 x i8] c"Going to execute '%s'\0A\00"
@.str.2 = [18 x i8] c"Could not open %s\00"
define i32* @gunzip(i8* %0, i8* nocapture %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %0)
%6 = load i32, i32* @stderr
%7 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%8 = call i32* @popen(i8* %4, i8* %1)
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 @fatal_error(i32 0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %0)
br label %12
12: ; preds = %10, %2
%13 = call i32 @push_ps(i32* %8)
ret i32* %8
}