#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 */
typedef int uint8_t;

/* Variables and functions */
scalar_t__ strncmp(char *, char *, int);
bool parseMode(char *word, uint8_t *mode) {
  return ((strncmp(word, "manual", 6) == 0) && (*mode = 1)) ||
         ((strncmp(word, "notify", 6) == 0) && (*mode = 2)) ||
         ((strncmp(word, "always", 6) == 0) && (*mode = 3));
}


x86 assembly (clang, -O0):
<parseMode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed5(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1156 <parseMode+0x46>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    $0x1,%al
test   $0x1,%al
mov    %al,-0x11(%rbp)
jne    11c8 <parseMode+0xb8>
mov    -0x8(%rbp),%rdi
lea    0xea6(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    118c <parseMode+0x7c>
mov    -0x10(%rbp),%rax
movl   $0x2,(%rax)
mov    $0x1,%al
test   $0x1,%al
mov    %al,-0x11(%rbp)
jne    11c8 <parseMode+0xb8>
mov    -0x8(%rbp),%rdi
lea    0xe77(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x12(%rbp)
jne    11c2 <parseMode+0xb2>
mov    -0x10(%rbp),%rax
movl   $0x3,(%rax)
mov    $0x1,%al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parseMode>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xedf(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
mov    $0x1,%ecx
test   %rax,%rax
je     1178 <parseMode+0x68>
lea    0xecb(%rip),%rsi
mov    %rbx,%rdi
mov    $0x6,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1173 <parseMode+0x63>
lea    0xeb9(%rip),%rsi
mov    %rbx,%rdi
mov    $0x6,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    1180 <parseMode+0x70>
mov    $0x3,%ecx
jmp    1178 <parseMode+0x68>
mov    $0x2,%ecx
mov    %ecx,(%r14)
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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