#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sc_mount_opt2str(unsigned long);
int /*<<< orphan*/ stderr;
unsigned long strtoul(char *, char **, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  if (argc != 2) {
    printf("usage: decode-mount-opts OPT\n");
    return 0;
  }
  char *end;
  unsigned long mountflags = strtoul(argv[1], &end, 0);
  if (*end != '\0') {
    fprintf(stderr, "cannot parse given argument as a number\n");
    return 1;
  }
  printf("%#lx is %s\n", mountflags, sc_mount_opt2str(mountflags));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     117a <main+0x3a>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11ee <main+0xae>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x18(%rbp),%rsi
xor    %edx,%edx
call   1060 <strtoul@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11c2 <main+0x82>
mov    0x2e38(%rip),%rax
mov    (%rax),%edi
lea    0xe6d(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11ee <main+0xae>
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <sc_mount_opt2str@plt>
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    1191 <main+0x41>
mov    0x8(%rsi),%rdi
mov    %rsp,%rsi
xor    %ebx,%ebx
xor    %edx,%edx
call   1070 <strtoul@plt>
mov    %rax,%r14
mov    (%rsp),%rax
cmpb   $0x0,(%rax)
je     11a1 <main+0x51>
mov    0x2e64(%rip),%rax
mov    (%rax),%edi
lea    0xe7b(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%ebx
jmp    11bc <main+0x6c>
lea    0xe9d(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
jmp    11bc <main+0x6c>
mov    %r14,%rdi
call   1040 <sc_mount_opt2str@plt>
lea    0xe79(%rip),%rdi
mov    %r14,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [30 x i8] c"usage: decode-mount-opts OPT\0A\00"
@stderr = global i32 0
@.str.1 = [41 x i8] c"cannot parse given argument as a number\0A\00"
@.str.2 = [12 x i8] c"%#lx is %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 2
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %29
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i64 @strtoul(i8* %15, i8** %6, i32 0)
store i64 %16, i64* %7
%17 = load i8*, i8** %6
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %12
%22 = load i32, i32* @stderr
%23 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %29
24: ; preds = %12
%25 = load i64, i64* %7
%26 = load i64, i64* %7
%27 = call i32 @sc_mount_opt2str(i64 %26)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i64 %25, i32 %27)
store i32 0, i32* %3
br label %29
29: ; preds = %24, %21, %10
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
@stderr = global i32 0
@.str.1 = [41 x i8] c"cannot parse given argument as a number\0A\00"
@.str.2 = [12 x i8] c"%#lx is %s\0A\00"
@str = [29 x i8] c"usage: decode-mount-opts OPT\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = icmp eq i32 %0, 2
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
br label %23
7: ; preds = %2
%8 = bitcast i8** %3 to i8*
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = call i64 @strtoul(i8* %10, i8** %3, i32 0)
%12 = load i8*, i8** %3
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %7
%16 = load i32, i32* @stderr
%17 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
br label %21
18: ; preds = %7
%19 = tail call i32 @sc_mount_opt2str(i64 %11)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i64 %11, i32 %19)
br label %21
21: ; preds = %18, %15
%22 = phi i32 [ 1, %15 ], [ 0, %18 ]
br label %23
23: ; preds = %21, %5
%24 = phi i32 [ 0, %5 ], [ %22, %21 ]
ret i32 %24
}