#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 /*<<< orphan*/ die(int, char *, ...);
int move_to_user_namespace(int);
int /*<<< orphan*/ strcmp(char const *, char *);
void move_to_user(const char *opt) {
  if (!(opt && *opt))
    die(3, "move-to-user: requires an option (i.e. move-to-user=10.6)");
  int r;
  if (!strcmp(opt, "10.5"))
    r = move_to_user_namespace(100500);
  else if (!strcmp(opt, "10.6"))
    r = move_to_user_namespace(100600);
  else if (!strcmp(opt, "10.10"))
    r = move_to_user_namespace(101000);
  else
    die(3, "move-to-user: unknown option: %s", opt);
  if (r)
    die(3, "move_to_user_namespace failed");
}


x86 assembly (clang, -O0):
<move_to_user>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1157 <move_to_user+0x27>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    116a <move_to_user+0x3a>
mov    $0x3,%edi
lea    0xe9d(%rip),%rsi
mov    $0x0,%al
call   1040 <die@plt>
mov    -0x8(%rbp),%rdi
lea    0xec5(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1195 <move_to_user+0x65>
mov    $0x18894,%edi
call   1050 <move_to_user_namespace@plt>
mov    %eax,-0xc(%rbp)
jmp    120c <move_to_user+0xdc>
mov    -0x8(%rbp),%rdi
lea    0xe9f(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11c0 <move_to_user+0x90>
mov    $0x188f8,%edi
call   1050 <move_to_user_namespace@plt>
mov    %eax,-0xc(%rbp)
jmp    1207 <move_to_user+0xd7>
mov    -0x8(%rbp),%rdi
lea    0xe79(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11eb <move_to_user+0xbb>
mov    $0x18a88,%edi
call   1050 <move_to_user_namespace@plt>
mov    %eax,-0xc(%rbp)
jmp    1202 <move_to_user+0xd2>
mov    -0x8(%rbp),%rdx
mov    $0x3,%edi
lea    0xe4f(%rip),%rsi
mov    $0x0,%al
call   1040 <die@plt>
jmp    1207 <move_to_user+0xd7>
jmp    120c <move_to_user+0xdc>
cmpl   $0x0,-0xc(%rbp)
je     1229 <move_to_user+0xf9>
mov    $0x3,%edi
lea    0xe49(%rip),%rsi
mov    $0x0,%al
call   1040 <die@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<move_to_user>:
push   %rbx
mov    %rdi,%rbx
test   %rdi,%rdi
je     113e <move_to_user+0xe>
cmpb   $0x0,(%rbx)
jne    1151 <move_to_user+0x21>
lea    0xebb(%rip),%rsi
mov    $0x3,%edi
xor    %eax,%eax
call   1040 <die@plt>
lea    0xee2(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11a2 <move_to_user+0x72>
lea    0xed4(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11a9 <move_to_user+0x79>
lea    0xec6(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11b0 <move_to_user+0x80>
lea    0xeb9(%rip),%rsi
mov    $0x3,%edi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <die@plt>
jmp    11be <move_to_user+0x8e>
mov    $0x18894,%edi
jmp    11b5 <move_to_user+0x85>
mov    $0x188f8,%edi
jmp    11b5 <move_to_user+0x85>
mov    $0x18a88,%edi
call   1050 <move_to_user_namespace@plt>
test   %eax,%eax
je     11d2 <move_to_user+0xa2>
lea    0xea6(%rip),%rsi
mov    $0x3,%edi
xor    %eax,%eax
pop    %rbx
jmp    1040 <die@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [58 x i8] c"move-to-user: requires an option (i.e. move-to-user=10.6)\00"
@.str.1 = [5 x i8] c"10.5\00"
@.str.2 = [5 x i8] c"10.6\00"
@.str.3 = [6 x i8] c"10.10\00"
@.str.4 = [33 x i8] c"move-to-user: unknown option: %s\00"
@.str.5 = [30 x i8] c"move_to_user_namespace failed\00"
define void @move_to_user(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %6, %1
%12 = call i32 (i32, i8*, ...) @die(i32 3, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %6
%14 = load i8*, i8** %2
%15 = call i32 @strcmp(i8* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp ne i32 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %13
%18 = call i32 @move_to_user_namespace(i32 100500)
store i32 %18, i32* %3
br label %36
19: ; preds = %13
%20 = load i8*, i8** %2
%21 = call i32 @strcmp(i8* %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%22 = icmp ne i32 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %19
%24 = call i32 @move_to_user_namespace(i32 100600)
store i32 %24, i32* %3
br label %35
25: ; preds = %19
%26 = load i8*, i8** %2
%27 = call i32 @strcmp(i8* %26, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%28 = icmp ne i32 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %25
%30 = call i32 @move_to_user_namespace(i32 101000)
store i32 %30, i32* %3
br label %34
31: ; preds = %25
%32 = load i8*, i8** %2
%33 = call i32 (i32, i8*, ...) @die(i32 3, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i8* %32)
br label %34
34: ; preds = %31, %29
br label %35
35: ; preds = %34, %23
br label %36
36: ; preds = %35, %17
%37 = load i32, i32* %3
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %36
%40 = call i32 (i32, i8*, ...) @die(i32 3, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
br label %41
41: ; preds = %39, %36
ret void
}

LLVM IR (-O2):
@.str = [58 x i8] c"move-to-user: requires an option (i.e. move-to-user=10.6)\00"
@.str.1 = [5 x i8] c"10.5\00"
@.str.2 = [5 x i8] c"10.6\00"
@.str.3 = [6 x i8] c"10.10\00"
@.str.4 = [33 x i8] c"move-to-user: unknown option: %s\00"
@.str.5 = [30 x i8] c"move_to_user_namespace failed\00"
define void @move_to_user(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3, %1
%7 = tail call i32 (i32, i8*, ...) @die(i32 3, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
%9 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %19, label %11
11: ; preds = %8
%12 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
br i1 %13, label %19, label %14
14: ; preds = %11
%15 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%16 = icmp eq i32 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %14
%18 = tail call i32 (i32, i8*, ...) @die(i32 3, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i8* %0)
br label %23
19: ; preds = %14, %11, %8
%20 = phi i32 [ 100500, %8 ], [ 100600, %11 ], [ 101000, %14 ]
%21 = tail call i32 @move_to_user_namespace(i32 %20)
%22 = icmp eq i32 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %17, %19
%24 = tail call i32 (i32, i8*, ...) @die(i32 3, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
br label %25
25: ; preds = %23, %19
ret void
}