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

/* Variables and functions */
scalar_t__ file_unzip(char *, char *, char *);
scalar_t__ malloc(size_t);
scalar_t__ pushIncludeFile(char *, long);
int /*<<< orphan*/ remove(char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
size_t strlen(char *);
int pushZipIncludeFile(char *zipfile, char *s, long offset) {
  char *tmpfile;
  char *tmpdir = "/tmp";
  if (file_unzip(zipfile, s, tmpdir) == 0) {
    tmpfile = (char *)malloc(strlen(tmpdir) + strlen(s) + 2);
    strcpy(tmpfile, tmpdir);
    strcat(tmpfile, "/");
    strcat(tmpfile, s);
    tmpfile[strlen(tmpfile)] = '\0';
    if (pushIncludeFile(tmpfile, offset)) {
      remove(tmpfile);
      return 1;
    } else {
      remove(tmpfile);
      return 0;
    }
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<pushZipIncludeFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
lea    0xe75(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x30(%rbp),%rdx
call   1090 <file_unzip@plt>
cmp    $0x0,%rax
jne    125b <pushZipIncludeFile+0xeb>
mov    -0x30(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x40(%rbp),%rdi
add    %rax,%rdi
add    $0x2,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x28(%rbp),%rdi
lea    0xe19(%rip),%rsi
call   1080 <strcat@plt>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1080 <strcat@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
movb   $0x0,(%rax,%rcx,1)
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1060 <pushIncludeFile@plt>
cmp    $0x0,%rax
je     1246 <pushZipIncludeFile+0xd6>
mov    -0x28(%rbp),%rdi
call   1030 <remove@plt>
movl   $0x1,-0x4(%rbp)
jmp    1262 <pushZipIncludeFile+0xf2>
mov    -0x28(%rbp),%rdi
call   1030 <remove@plt>
movl   $0x0,-0x4(%rbp)
jmp    1262 <pushZipIncludeFile+0xf2>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pushZipIncludeFile>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
lea    0xe7c(%rip),%rdx
call   1090 <file_unzip@plt>
xor    %ebp,%ebp
test   %rax,%rax
jne    11f5 <pushZipIncludeFile+0x85>
mov    %r15,%rdi
call   1050 <strlen@plt>
lea    0x6(%rax),%rdi
call   1070 <malloc@plt>
mov    %rax,%rbx
lea    0xe55(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcpy@plt>
lea    0xe4b(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcat@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1080 <strcat@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <pushIncludeFile@plt>
xor    %ebp,%ebp
test   %rax,%rax
setne  %bpl
mov    %rbx,%rdi
call   1030 <remove@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"/tmp\00"
@.str.1 = [2 x i8] c"/\00"
define i32 @pushZipIncludeFile(i8* %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %9
%10 = load i8*, i8** %5
%11 = load i8*, i8** %6
%12 = load i8*, i8** %9
%13 = call i64 @file_unzip(i8* %10, i8* %11, i8* %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %46
15: ; preds = %3
%16 = load i8*, i8** %9
%17 = call i64 @strlen(i8* %16)
%18 = load i8*, i8** %6
%19 = call i64 @strlen(i8* %18)
%20 = add i64 %17, %19
%21 = add i64 %20, 2
%22 = call i64 @malloc(i64 %21)
%23 = inttoptr i64 %22 to i8*
store i8* %23, i8** %8
%24 = load i8*, i8** %8
%25 = load i8*, i8** %9
%26 = call i32 @strcpy(i8* %24, i8* %25)
%27 = load i8*, i8** %8
%28 = call i32 @strcat(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%29 = load i8*, i8** %8
%30 = load i8*, i8** %6
%31 = call i32 @strcat(i8* %29, i8* %30)
%32 = load i8*, i8** %8
%33 = load i8*, i8** %8
%34 = call i64 @strlen(i8* %33)
%35 = getelementptr inbounds i8, i8* %32, i64 %34
store i8 0, i8* %35
%36 = load i8*, i8** %8
%37 = load i64, i64* %7
%38 = call i64 @pushIncludeFile(i8* %36, i64 %37)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %15
%41 = load i8*, i8** %8
%42 = call i32 @remove(i8* %41)
store i32 1, i32* %4
br label %47
43: ; preds = %15
%44 = load i8*, i8** %8
%45 = call i32 @remove(i8* %44)
store i32 0, i32* %4
br label %47
46: ; preds = %3
store i32 0, i32* %4
br label %47
47: ; preds = %46, %43, %40
%48 = load i32, i32* %4
ret i32 %48
}

LLVM IR (-O2):
@.str = [5 x i8] c"/tmp\00"
@.str.1 = [2 x i8] c"/\00"
define i32 @pushZipIncludeFile(i8* %0, i8* %1, i64 %2) {
%4 = tail call i64 @file_unzip(i8* %0, i8* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %20
6: ; preds = %3
%7 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%8 = add i64 %7, 6
%9 = tail call i64 @malloc(i64 %8)
%10 = inttoptr i64 %9 to i8*
%11 = tail call i32 @strcpy(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%12 = tail call i32 @strcat(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%13 = tail call i32 @strcat(i8* %10, i8* %1)
%14 = tail call i64 @strlen(i8* dereferenceable(1) %10)
%15 = getelementptr inbounds i8, i8* %10, i64 %14
store i8 0, i8* %15
%16 = tail call i64 @pushIncludeFile(i8* %10, i64 %2)
%17 = icmp ne i64 %16, 0
%18 = tail call i32 @remove(i8* %10)
%19 = zext i1 %17 to i32
br label %20
20: ; preds = %6, %3
%21 = phi i32 [ 0, %3 ], [ %19, %6 ]
ret i32 %21
}