#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__ strcmp(char const *, char *);
int toml_rtob(const char *src, int *ret_) {
  if (!src)
    return -1;
  int dummy;
  int *ret = ret_ ? ret_ : &dummy;
  if (0 == strcmp(src, "true")) {
    *ret = 1;
    return 0;
  }
  if (0 == strcmp(src, "false")) {
    *ret = 0;
    return 0;
  }
  return -1;
}


x86 assembly (clang, -O0):
<toml_rtob>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1137 <toml_rtob+0x27>
movl   $0xffffffff,-0x4(%rbp)
jmp    11d3 <toml_rtob+0xc3>
cmpq   $0x0,-0x18(%rbp)
je     114f <toml_rtob+0x3f>
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
jmp    115c <toml_rtob+0x4c>
lea    -0x1c(%rbp),%rax
mov    %rax,-0x30(%rbp)
jmp    115c <toml_rtob+0x4c>
mov    -0x30(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe91(%rip),%rsi
call   1030 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    1198 <toml_rtob+0x88>
mov    -0x28(%rbp),%rax
movl   $0x1,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    11d3 <toml_rtob+0xc3>
mov    -0x10(%rbp),%rdi
lea    0xe62(%rip),%rsi
call   1030 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    11cc <toml_rtob+0xbc>
mov    -0x28(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    11d3 <toml_rtob+0xc3>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<toml_rtob>:
test   %rdi,%rdi
je     1159 <toml_rtob+0x49>
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
test   %rsi,%rsi
lea    0x4(%rsp),%r14
cmovne %rsi,%r14
lea    0xed1(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     115f <toml_rtob+0x4f>
lea    0xec5(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
jne    1169 <toml_rtob+0x59>
xor    %eax,%eax
jmp    1164 <toml_rtob+0x54>
mov    $0xffffffff,%eax
ret
mov    $0x1,%eax
mov    %eax,(%r14)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"true\00"
@.str.1 = [6 x i8] c"false\00"
define i32 @toml_rtob(i8* %0, i32* writeonly %1) {
%3 = alloca i32
%4 = icmp eq i8* %0, null
br i1 %4, label %18, label %5
5: ; preds = %2
%6 = bitcast i32* %3 to i8*
%7 = icmp eq i32* %1, null
%8 = select i1 %7, i32* %3, i32* %1
%9 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %5
%12 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %11, %5
%15 = phi i32 [ 1, %5 ], [ 0, %11 ]
store i32 %15, i32* %8
br label %16
16: ; preds = %14, %11
%17 = phi i32 [ -1, %11 ], [ 0, %14 ]
br label %18
18: ; preds = %2, %16
%19 = phi i32 [ %17, %16 ], [ -1, %2 ]
ret i32 %19
}