#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__ strcasecmp(char *, char *);
int parse_verbosity(char *str, int *verbosity) {
  if (strcasecmp(str, "quiet") == 0)
    *verbosity = 0;
  else if (strcasecmp(str, "error") == 0)
    *verbosity = 1;
  else if (strcasecmp(str, "info") == 0)
    *verbosity = 2;
  else if (strcasecmp(str, "debug") == 0)
    *verbosity = 3;
  else
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<parse_verbosity>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed5(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1149 <parse_verbosity+0x39>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
jmp    11df <parse_verbosity+0xcf>
mov    -0x10(%rbp),%rdi
lea    0xeb2(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1172 <parse_verbosity+0x62>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
jmp    11da <parse_verbosity+0xca>
mov    -0x10(%rbp),%rdi
lea    0xe8f(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    119b <parse_verbosity+0x8b>
mov    -0x18(%rbp),%rax
movl   $0x2,(%rax)
jmp    11d5 <parse_verbosity+0xc5>
mov    -0x10(%rbp),%rdi
lea    0xe6b(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    11c4 <parse_verbosity+0xb4>
mov    -0x18(%rbp),%rax
movl   $0x3,(%rax)
jmp    11d0 <parse_verbosity+0xc0>
movl   $0x0,-0x4(%rbp)
jmp    11e6 <parse_verbosity+0xd6>
jmp    11d5 <parse_verbosity+0xc5>
jmp    11da <parse_verbosity+0xca>
jmp    11df <parse_verbosity+0xcf>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_verbosity>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xedf(%rip),%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1173 <parse_verbosity+0x63>
lea    0xed4(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1177 <parse_verbosity+0x67>
lea    0xec6(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     117e <parse_verbosity+0x6e>
lea    0xeb7(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    118b <parse_verbosity+0x7b>
mov    $0x3,%eax
jmp    1183 <parse_verbosity+0x73>
xor    %eax,%eax
jmp    1183 <parse_verbosity+0x73>
mov    $0x1,%eax
jmp    1183 <parse_verbosity+0x73>
mov    $0x2,%eax
mov    %eax,(%r14)
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"quiet\00"
@.str.1 = [6 x i8] c"error\00"
@.str.2 = [5 x i8] c"info\00"
@.str.3 = [6 x i8] c"debug\00"
define i32 @parse_verbosity(i8* nocapture %0, i32* nocapture writeonly %1) {
%3 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
br i1 %4, label %14, label %5
5: ; preds = %2
%6 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %14, label %8
8: ; preds = %5
%9 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %11, %8, %5, %2
%15 = phi i32 [ 0, %2 ], [ 1, %5 ], [ 2, %8 ], [ 3, %11 ]
store i32 %15, i32* %1
br label %16
16: ; preds = %14, %11
%17 = phi i32 [ 0, %11 ], [ 1, %14 ]
ret i32 %17
}