#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 request {
  int dummy;
};
struct cgi_parameters {
  int dummy;
};

/* Variables and functions */
int make_cgi_argv(struct request *, struct cgi_parameters *);
int make_cgi_envp(struct request *, struct cgi_parameters *);
int init_cgi_env(struct request *r, struct cgi_parameters *cp) {
  if (make_cgi_envp(r, cp) == -1)
    return -1;
  if (make_cgi_argv(r, cp) == -1)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<init_cgi_env>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <make_cgi_envp@plt>
cmp    $0xffffffff,%eax
jne    1152 <init_cgi_env+0x32>
movl   $0xffffffff,-0x4(%rbp)
jmp    117b <init_cgi_env+0x5b>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <make_cgi_argv@plt>
cmp    $0xffffffff,%eax
jne    1174 <init_cgi_env+0x54>
movl   $0xffffffff,-0x4(%rbp)
jmp    117b <init_cgi_env+0x5b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_cgi_env>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <make_cgi_envp@plt>
cmp    $0xffffffff,%eax
je     114d <init_cgi_env+0x2d>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <make_cgi_argv@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
sete   %al
neg    %eax
jmp    1152 <init_cgi_env+0x32>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.request = type { i32 }
%struct.cgi_parameters = type { i32 }
define i32 @init_cgi_env(%struct.request* %0, %struct.cgi_parameters* %1) {
%3 = alloca i32
%4 = alloca %struct.request*
%5 = alloca %struct.cgi_parameters*
store %struct.request* %0, %struct.request** %4
store %struct.cgi_parameters* %1, %struct.cgi_parameters** %5
%6 = load %struct.request*, %struct.request** %4
%7 = load %struct.cgi_parameters*, %struct.cgi_parameters** %5
%8 = call i32 @make_cgi_envp(%struct.request* %6, %struct.cgi_parameters* %7)
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 -1, i32* %3
br label %18
11: ; preds = %2
%12 = load %struct.request*, %struct.request** %4
%13 = load %struct.cgi_parameters*, %struct.cgi_parameters** %5
%14 = call i32 @make_cgi_argv(%struct.request* %12, %struct.cgi_parameters* %13)
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %17
16: ; preds = %11
store i32 -1, i32* %3
br label %18
17: ; preds = %11
store i32 0, i32* %3
br label %18
18: ; preds = %17, %16, %10
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
%struct.request = type { i32 }
%struct.cgi_parameters = type { i32 }
define i32 @init_cgi_env(%struct.request* %0, %struct.cgi_parameters* %1) {
%3 = tail call i32 @make_cgi_envp(%struct.request* %0, %struct.cgi_parameters* %1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = tail call i32 @make_cgi_argv(%struct.request* %0, %struct.cgi_parameters* %1)
%7 = icmp eq i32 %6, -1
%8 = sext i1 %7 to i32
br label %9
9: ; preds = %5, %2
%10 = phi i32 [ -1, %2 ], [ %8, %5 ]
ret i32 %10
}