int read_boolean(s)
char *s;
{
  char p[10];
  int result;
  p[0] = '\0';
  sscanf(s, " %10s", p);
  result = 1;
  if ((strcmp(p, "0") == 0) || (strcmp(p, "no") == 0) ||
      (strcmp(p, "false") == 0)) {
    result = 0;
  };
  return (result);
}


x86 assembly (clang, -O0):
<read_boolean>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x0,-0x12(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x12(%rbp),%rdx
lea    0xec1(%rip),%rsi
mov    $0x0,%al
call   1040 <sscanf@plt>
movl   $0x1,-0x18(%rbp)
lea    -0x12(%rbp),%rdi
lea    0xeae(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
je     1198 <read_boolean+0x78>
lea    -0x12(%rbp),%rdi
lea    0xe97(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
je     1198 <read_boolean+0x78>
lea    -0x12(%rbp),%rdi
lea    0xe81(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    119f <read_boolean+0x7f>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_boolean>:
sub    $0x18,%rsp
movb   $0x0,0xe(%rsp)
lea    0xee0(%rip),%rsi
lea    0xe(%rsp),%rdx
xor    %eax,%eax
call   1030 <sscanf@plt>
cmpw   $0x30,0xe(%rsp)
je     1167 <read_boolean+0x57>
movzwl 0xe(%rsp),%eax
xor    $0x6f6e,%eax
movzbl 0x10(%rsp),%ecx
or     %ax,%cx
je     1167 <read_boolean+0x57>
mov    $0x736c6166,%eax
xor    0xe(%rsp),%eax
movzwl 0x12(%rsp),%ecx
xor    $0x65,%ecx
or     %eax,%ecx
mov    $0x1,%eax
je     1167 <read_boolean+0x57>
add    $0x18,%rsp
ret
xor    %eax,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c" %10s\00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [3 x i8] c"no\00"
@.str.3 = [6 x i8] c"false\00"
define i32 @read_boolean(i8* nocapture %0) {
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
store i8 0, i8* %3
%4 = call i32 (i8*, i8*, ...) @sscanf(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @bcmp(i8* dereferenceable(2) %3, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i64 2)
%6 = icmp eq i32 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %1
%8 = call i32 @bcmp(i8* dereferenceable(3) %3, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i64 3)
%9 = icmp eq i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = call i32 @bcmp(i8* dereferenceable(6) %3, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i64 6)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %10, %7, %1
br label %14
14: ; preds = %13, %10
%15 = phi i32 [ 0, %13 ], [ 1, %10 ]
ret i32 %15
}