#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 */
int /*<<< orphan*/ strcmp(char *, char *);
int ccache_item_set_bool(void *p, char *buffer) {
  char *np = (char *)p;
  if (!strcmp(buffer, "1")) {
    *np = 1;
  } else if (!strcmp(buffer, "0")) {
    *np = 0;
  } else {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<ccache_item_set_bool>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xecd(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    114d <ccache_item_set_bool+0x3d>
mov    -0x20(%rbp),%rax
movb   $0x1,(%rax)
jmp    1183 <ccache_item_set_bool+0x73>
mov    -0x18(%rbp),%rdi
lea    0xeaa(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1172 <ccache_item_set_bool+0x62>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
jmp    117e <ccache_item_set_bool+0x6e>
movl   $0xffffffff,-0x4(%rbp)
jmp    118a <ccache_item_set_bool+0x7a>
jmp    1183 <ccache_item_set_bool+0x73>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ccache_item_set_bool>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xedf(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     114b <ccache_item_set_bool+0x3b>
lea    0xece(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
test   %ecx,%ecx
jne    1152 <ccache_item_set_bool+0x42>
xor    %eax,%eax
jmp    114d <ccache_item_set_bool+0x3d>
mov    $0x1,%al
mov    %al,(%r14)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"1\00"
@.str.1 = [2 x i8] c"0\00"
define i32 @ccache_item_set_bool(i8* nocapture writeonly %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5, %2
%9 = phi i8 [ 1, %2 ], [ 0, %5 ]
store i8 %9, i8* %0
br label %10
10: ; preds = %5, %8
%11 = phi i32 [ 0, %8 ], [ -1, %5 ]
ret i32 %11
}