#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*/ strcasecmp(char *, char *);
int read_yn(char *line, void *arg) {
  char *dest = arg;
  int retval = 1;
  if (!strcasecmp("yes", line))
    *dest = 1;
  else if (!strcasecmp("no", line))
    *dest = 0;
  else
    retval = 0;
  return retval;
}


x86 assembly (clang, -O0):
<read_yn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec6(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    1154 <read_yn+0x44>
mov    -0x18(%rbp),%rax
movb   $0x1,(%rax)
jmp    1185 <read_yn+0x75>
mov    -0x8(%rbp),%rsi
lea    0xea5(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    1179 <read_yn+0x69>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
jmp    1180 <read_yn+0x70>
movl   $0x0,-0x1c(%rbp)
jmp    1185 <read_yn+0x75>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_yn>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xedf(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     1146 <read_yn+0x36>
lea    0xed0(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
jne    1150 <read_yn+0x40>
jmp    1148 <read_yn+0x38>
mov    $0x1,%al
mov    %al,(%r14)
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"yes\00"
@.str.1 = [3 x i8] c"no\00"
define i32 @read_yn(i8* nocapture %0, i8* nocapture writeonly %1) {
%3 = tail call i32 @strcasecmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @strcasecmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %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* %1
br label %10
10: ; preds = %8, %5
%11 = phi i32 [ 0, %5 ], [ 1, %8 ]
ret i32 %11
}