#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 */
char *j0g_str(char *, char *, unsigned short *);
scalar_t__ strcmp(char *, char *);
int j0g_test(char *key, char *json, unsigned short *index) {
  char *val = j0g_str(key, json, index);
  if (!val)
    return 0;
  if (strcmp(val, "true") == 0)
    return 1;
  if (strcmp(val, "1") == 0)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<j0g_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <j0g_str@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1160 <j0g_test+0x40>
movl   $0x0,-0x4(%rbp)
jmp    11b3 <j0g_test+0x93>
mov    -0x28(%rbp),%rdi
lea    0xe95(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1186 <j0g_test+0x66>
movl   $0x1,-0x4(%rbp)
jmp    11b3 <j0g_test+0x93>
mov    -0x28(%rbp),%rdi
lea    0xe74(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11ac <j0g_test+0x8c>
movl   $0x1,-0x4(%rbp)
jmp    11b3 <j0g_test+0x93>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<j0g_test>:
push   %rbx
call   1040 <j0g_str@plt>
test   %rax,%rax
je     115e <j0g_test+0x3e>
mov    %rax,%rbx
lea    0xecb(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1162 <j0g_test+0x42>
lea    0xebc(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"true\00"
@.str.1 = [2 x i8] c"1\00"
define i32 @j0g_test(i8* %0, i8* %1, i16* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i16*
%8 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i16* %2, i16** %7
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = load i16*, i16** %7
%12 = call i8* @j0g_str(i8* %9, i8* %10, i16* %11)
store i8* %12, i8** %8
%13 = load i8*, i8** %8
%14 = icmp ne i8* %13, null
br i1 %14, label %16, label %15
15: ; preds = %3
store i32 0, i32* %4
br label %27
16: ; preds = %3
%17 = load i8*, i8** %8
%18 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %16
store i32 1, i32* %4
br label %27
21: ; preds = %16
%22 = load i8*, i8** %8
%23 = call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %21
store i32 1, i32* %4
br label %27
26: ; preds = %21
store i32 0, i32* %4
br label %27
27: ; preds = %26, %25, %20, %15
%28 = load i32, i32* %4
ret i32 %28
}

LLVM IR (-O2):
@.str = [5 x i8] c"true\00"
@.str.1 = [2 x i8] c"1\00"
define i32 @j0g_test(i8* %0, i8* %1, i16* %2) {
%4 = tail call i8* @j0g_str(i8* %0, i8* %1, i16* %2)
%5 = icmp eq i8* %4, null
br i1 %5, label %13, label %6
6: ; preds = %3
%7 = tail call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %6
%10 = tail call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %9, %6, %3
%14 = phi i32 [ 0, %3 ], [ 1, %6 ], [ %12, %9 ]
ret i32 %14
}