#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 SEEK_CUR;
int SEEK_END;
int SEEK_SET;
int /*<<< orphan*/ strcmp(char *, char *);
int read_seek_flag(char *s) {
  int flag = 0;
  if (!strcmp(s, "SEEK_SET")) {
    flag |= SEEK_SET;
  } else if (!strcmp(s, "SEEK_CUR")) {
    flag |= SEEK_CUR;
  } else if (!strcmp(s, "SEEK_END")) {
    flag |= SEEK_END;
  }
  return flag;
}


x86 assembly (clang, -O0):
<read_seek_flag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed2(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1150 <read_seek_flag+0x40>
mov    0x2e8d(%rip),%rax
mov    (%rax),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11af <read_seek_flag+0x9f>
mov    -0x8(%rbp),%rdi
lea    0xeae(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    117d <read_seek_flag+0x6d>
mov    0x2e70(%rip),%rax
mov    (%rax),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11aa <read_seek_flag+0x9a>
mov    -0x8(%rbp),%rdi
lea    0xe8a(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11a5 <read_seek_flag+0x95>
mov    0x2e4b(%rip),%rax
mov    (%rax),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11aa <read_seek_flag+0x9a>
jmp    11af <read_seek_flag+0x9f>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_seek_flag>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1157 <read_seek_flag+0x47>
lea    0xede(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1160 <read_seek_flag+0x50>
lea    0xed4(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
jne    1169 <read_seek_flag+0x59>
mov    0x2e93(%rip),%rax
jmp    1167 <read_seek_flag+0x57>
mov    0x2e72(%rip),%rax
jmp    1167 <read_seek_flag+0x57>
mov    0x2e79(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c"SEEK_SET\00"
@SEEK_SET = global i32 0
@.str.1 = [9 x i8] c"SEEK_CUR\00"
@SEEK_CUR = global i32 0
@.str.2 = [9 x i8] c"SEEK_END\00"
@SEEK_END = global i32 0
define i32 @read_seek_flag(i8* nocapture %0) {
%2 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = load i32, i32* @SEEK_SET
br label %16
6: ; preds = %1
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = load i32, i32* @SEEK_CUR
br label %16
11: ; preds = %6
%12 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
%14 = load i32, i32* @SEEK_END
%15 = select i1 %13, i32 %14, i32 0
br label %16
16: ; preds = %11, %9, %4
%17 = phi i32 [ %10, %9 ], [ %5, %4 ], [ %15, %11 ]
ret i32 %17
}