#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 */
struct zip_stat {
  int dummy;
};
struct zip {
  int dummy;
};

/* Variables and functions */
int zip_name_locate(struct zip *, char const *, int);
int zip_stat_index(struct zip *, int, int, struct zip_stat *);
int zip_stat(struct zip *za, const char *fname, int flags,
             struct zip_stat *st) {
  int idx;
  if ((idx = zip_name_locate(za, fname, flags)) < 0)
    return -1;
  return zip_stat_index(za, idx, flags, st);
}


x86 assembly (clang, -O0):
<zip_stat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <zip_name_locate@plt>
mov    %eax,-0x2c(%rbp)
cmp    $0x0,%eax
jge    115f <zip_stat+0x3f>
movl   $0xffffffff,-0x4(%rbp)
jmp    1175 <zip_stat+0x55>
mov    -0x10(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x28(%rbp),%rcx
call   1030 <zip_stat_index@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zip_stat>:
push   %rbp
push   %r14
push   %rbx
mov    %rcx,%r14
mov    %edx,%ebp
mov    %rdi,%rbx
call   1040 <zip_name_locate@plt>
test   %eax,%eax
js     1148 <zip_stat+0x28>
mov    %rbx,%rdi
mov    %eax,%esi
mov    %ebp,%edx
mov    %r14,%rcx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <zip_stat_index@plt>
mov    $0xffffffff,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.zip = type { i32 }
%struct.zip_stat = type { i32 }
define i32 @zip_stat(%struct.zip* %0, i8* %1, i32 %2, %struct.zip_stat* %3) {
%5 = alloca i32
%6 = alloca %struct.zip*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca %struct.zip_stat*
%10 = alloca i32
store %struct.zip* %0, %struct.zip** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store %struct.zip_stat* %3, %struct.zip_stat** %9
%11 = load %struct.zip*, %struct.zip** %6
%12 = load i8*, i8** %7
%13 = load i32, i32* %8
%14 = call i32 @zip_name_locate(%struct.zip* %11, i8* %12, i32 %13)
store i32 %14, i32* %10
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %4
store i32 -1, i32* %5
br label %23
17: ; preds = %4
%18 = load %struct.zip*, %struct.zip** %6
%19 = load i32, i32* %10
%20 = load i32, i32* %8
%21 = load %struct.zip_stat*, %struct.zip_stat** %9
%22 = call i32 @zip_stat_index(%struct.zip* %18, i32 %19, i32 %20, %struct.zip_stat* %21)
store i32 %22, i32* %5
br label %23
23: ; preds = %17, %16
%24 = load i32, i32* %5
ret i32 %24
}

LLVM IR (-O2):
%struct.zip = type { i32 }
%struct.zip_stat = type { i32 }
define i32 @zip_stat(%struct.zip* %0, i8* %1, i32 %2, %struct.zip_stat* %3) {
%5 = tail call i32 @zip_name_locate(%struct.zip* %0, i8* %1, i32 %2)
%6 = icmp slt i32 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @zip_stat_index(%struct.zip* %0, i32 %5, i32 %2, %struct.zip_stat* %3)
br label %9
9: ; preds = %4, %7
%10 = phi i32 [ %8, %7 ], [ -1, %4 ]
ret i32 %10
}