#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 /*<<< orphan*/ opts;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
#define MS_PRIVATE 131
#define MS_REC 130
#define MS_SHARED 129
#define MS_SLAVE 128
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char const *, char const *);
int /*<<< orphan*/ usage(int /*<<< orphan*/);
unsigned long parse_propagation(const char *str) {
  size_t i;
  static const struct prop_opts {
    const char *name;
    unsigned long flag;
  } opts[] = {{"slave", MS_REC | MS_SLAVE},
              {"private", MS_REC | MS_PRIVATE},
              {"shared", MS_REC | MS_SHARED},
              {"unchanged", 0}};
  for (i = 0; i < (sizeof(opts) / sizeof(opts[0])); i++) {
    if (strcmp(opts[i].name, str) == 0)
      return opts[i].flag;
  }
  fprintf(stderr, "unsupported propagation mode: %s", str);
  usage(EXIT_FAILURE);
  return 0;
}


x86 assembly (clang, -O0):
<parse_propagation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x4,-0x18(%rbp)
jae    11ac <parse_propagation+0x7c>
mov    -0x18(%rbp),%rcx
lea    0x2c76(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1196 <parse_propagation+0x66>
mov    -0x18(%rbp),%rcx
lea    0x2c4e(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    0x8(%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    11db <parse_propagation+0xab>
jmp    119b <parse_propagation+0x6b>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1144 <parse_propagation+0x14>
mov    0x2e2d(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe5f(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e0c(%rip),%rax
mov    (%rax),%edi
call   1050 <usage@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_propagation>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11ae <parse_propagation+0x7e>
lea    0xeb7(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11b2 <parse_propagation+0x82>
lea    0xeab(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11b9 <parse_propagation+0x89>
lea    0xe9e(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11c0 <parse_propagation+0x90>
mov    0x2e55(%rip),%rax
mov    (%rax),%edi
lea    0xe8b(%rip),%rsi
mov    %rbx,%rdx
call   1040 <fprintf@plt>
mov    0x2e35(%rip),%rax
mov    (%rax),%edi
call   1050 <usage@plt>
xor    %eax,%eax
pop    %rbx
ret
xor    %eax,%eax
jmp    11c5 <parse_propagation+0x95>
mov    $0x1,%eax
jmp    11c5 <parse_propagation+0x95>
mov    $0x2,%eax
jmp    11c5 <parse_propagation+0x95>
mov    $0x3,%eax
shl    $0x4,%rax
lea    0x2c00(%rip),%rcx
mov    0x8(%rax,%rcx,1),%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.prop_opts = type { i8*, i64 }
@parse_propagation.opts = internal constant [4 x %struct.prop_opts] [%struct.prop_opts { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i64 130 }, %struct.prop_opts { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i32 0, i32 0), i64 131 }, %struct.prop_opts { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i64 131 }, %struct.prop_opts { i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i32 0, i32 0), i64 0 }]
@.str = [6 x i8] c"slave\00"
@.str.1 = [8 x i8] c"private\00"
@.str.2 = [7 x i8] c"shared\00"
@.str.3 = [10 x i8] c"unchanged\00"
@stderr = global i32 0
@.str.4 = [33 x i8] c"unsupported propagation mode: %s\00"
@EXIT_FAILURE = global i32 0
define i64 @parse_propagation(i8* %0) {
%2 = alloca i64
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 0, i64* %4
br label %5
5: ; preds = %22, %1
%6 = load i64, i64* %4
%7 = icmp ult i64 %6, 4
br i1 %7, label %8, label %25
8: ; preds = %5
%9 = load i64, i64* %4
%10 = getelementptr inbounds [4 x %struct.prop_opts], [4 x %struct.prop_opts]* @parse_propagation.opts, i64 0, i64 %9
%11 = getelementptr inbounds %struct.prop_opts, %struct.prop_opts* %10, i32 0, i32 0
%12 = load i8*, i8** %11
%13 = load i8*, i8** %3
%14 = call i64 @strcmp(i8* %12, i8* %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %8
%17 = load i64, i64* %4
%18 = getelementptr inbounds [4 x %struct.prop_opts], [4 x %struct.prop_opts]* @parse_propagation.opts, i64 0, i64 %17
%19 = getelementptr inbounds %struct.prop_opts, %struct.prop_opts* %18, i32 0, i32 1
%20 = load i64, i64* %19
store i64 %20, i64* %2
br label %31
21: ; preds = %8
br label %22
22: ; preds = %21
%23 = load i64, i64* %4
%24 = add i64 %23, 1
store i64 %24, i64* %4
br label %5
25: ; preds = %5
%26 = load i32, i32* @stderr
%27 = load i8*, i8** %3
%28 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i8* %27)
%29 = load i32, i32* @EXIT_FAILURE
%30 = call i32 @usage(i32 %29)
store i64 0, i64* %2
br label %31
31: ; preds = %25, %16
%32 = load i64, i64* %2
ret i64 %32
}

LLVM IR (-O2):
%struct.prop_opts = type { i8*, i64 }
@parse_propagation.opts = internal unnamed_addr constant [4 x %struct.prop_opts] [%struct.prop_opts { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i64 130 }, %struct.prop_opts { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i32 0, i32 0), i64 131 }, %struct.prop_opts { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i64 131 }, %struct.prop_opts { i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i32 0, i32 0), i64 0 }]
@.str = [6 x i8] c"slave\00"
@.str.1 = [8 x i8] c"private\00"
@.str.2 = [7 x i8] c"shared\00"
@.str.3 = [10 x i8] c"unchanged\00"
@stderr = global i32 0
@.str.4 = [33 x i8] c"unsupported propagation mode: %s\00"
@EXIT_FAILURE = global i32 0
define i64 @parse_propagation(i8* %0) {
%2 = tail call i64 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %14, %11, %8, %1
%5 = phi i64 [ 0, %1 ], [ 1, %8 ], [ 2, %11 ], [ 3, %14 ]
%6 = getelementptr inbounds [4 x %struct.prop_opts], [4 x %struct.prop_opts]* @parse_propagation.opts, i64 0, i64 %5, i32 1
%7 = load i64, i64* %6
br label %22
8: ; preds = %1
%9 = tail call i64 @strcmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%10 = icmp eq i64 %9, 0
br i1 %10, label %4, label %11
11: ; preds = %8
%12 = tail call i64 @strcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%13 = icmp eq i64 %12, 0
br i1 %13, label %4, label %14
14: ; preds = %11
%15 = tail call i64 @strcmp(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %0)
%16 = icmp eq i64 %15, 0
br i1 %16, label %4, label %17
17: ; preds = %14
%18 = load i32, i32* @stderr
%19 = tail call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i8* %0)
%20 = load i32, i32* @EXIT_FAILURE
%21 = tail call i32 @usage(i32 %20)
br label %22
22: ; preds = %17, %4
%23 = phi i64 [ %7, %4 ], [ 0, %17 ]
ret i64 %23
}