#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 my_struct {
  int dummy;
};
struct jslex {
  int dummy;
};

/* Variables and functions */
scalar_t__ my_colon(struct jslex *);
scalar_t__ my_key(struct jslex *, char *);
scalar_t__ my_root__foo_value(struct my_struct *, struct jslex *);
int my_root__foo(struct my_struct *dest, struct jslex *lexer) {
  return my_key(lexer, "foo") && my_colon(lexer) &&
         my_root__foo_value(dest, lexer);
}


x86 assembly (clang, -O0):
<my_root__foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb5(%rip),%rsi
call   1030 <my_key@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x11(%rbp)
je     1194 <my_root__foo+0x64>
mov    -0x10(%rbp),%rdi
call   1050 <my_colon@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x11(%rbp)
je     1194 <my_root__foo+0x64>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <my_root__foo_value@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_root__foo>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xebf(%rip),%rsi
mov    %rbx,%rdi
call   1030 <my_key@plt>
xor    %ebp,%ebp
test   %rax,%rax
je     1171 <my_root__foo+0x41>
mov    %rbx,%rdi
call   1050 <my_colon@plt>
test   %rax,%rax
je     1171 <my_root__foo+0x41>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <my_root__foo_value@plt>
xor    %ebp,%ebp
test   %rax,%rax
setne  %bpl
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.my_struct = type { i32 }
%struct.jslex = type { i32 }
@.str = [4 x i8] c"foo\00"
define i32 @my_root__foo(%struct.my_struct* %0, %struct.jslex* %1) {
%3 = alloca %struct.my_struct*
%4 = alloca %struct.jslex*
store %struct.my_struct* %0, %struct.my_struct** %3
store %struct.jslex* %1, %struct.jslex** %4
%5 = load %struct.jslex*, %struct.jslex** %4
%6 = call i64 @my_key(%struct.jslex* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %17
8: ; preds = %2
%9 = load %struct.jslex*, %struct.jslex** %4
%10 = call i64 @my_colon(%struct.jslex* %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %8
%13 = load %struct.my_struct*, %struct.my_struct** %3
%14 = load %struct.jslex*, %struct.jslex** %4
%15 = call i64 @my_root__foo_value(%struct.my_struct* %13, %struct.jslex* %14)
%16 = icmp ne i64 %15, 0
br label %17
17: ; preds = %12, %8, %2
%18 = phi i1 [ false, %8 ], [ false, %2 ], [ %16, %12 ]
%19 = zext i1 %18 to i32
ret i32 %19
}

LLVM IR (-O2):
%struct.my_struct = type { i32 }
%struct.jslex = type { i32 }
@.str = [4 x i8] c"foo\00"
define i32 @my_root__foo(%struct.my_struct* %0, %struct.jslex* %1) {
%3 = tail call i64 @my_key(%struct.jslex* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %2
%6 = tail call i64 @my_colon(%struct.jslex* %1)
%7 = icmp eq i64 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %5
%9 = tail call i64 @my_root__foo_value(%struct.my_struct* %0, %struct.jslex* %1)
%10 = icmp ne i64 %9, 0
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %8, %5, %2
%13 = phi i32 [ 0, %5 ], [ 0, %2 ], [ %11, %8 ]
ret i32 %13
}