#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int show_error(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, ...);
scalar_t__ strcmp(char *, char *);
scalar_t__ system(char *);
int mount_efi(char mount_point[], int interactive) {
  char _identifier[15] = "disk0s1";
  char cmd[300];
  if (interactive) {
    if (system("diskutil list") != 0)
      return show_error("You cannot do this operation in single user mode!");
    printf("Enter the IDENTIFIER of the EFI partition to be mounted (e.g: "
           "disk0s1): ");
    scanf("%s", _identifier);
  }
  if (strcmp(mount_point, "") == 0)
    sprintf(cmd, "diskutil mount %s", _identifier);
  else {
    sprintf(cmd, "diskutil unmount force %s", _identifier);
    system(cmd);
    sprintf(cmd, "diskutil mount -mountPoint %s %s", mount_point, _identifier);
  }
  if (system(cmd) != 0)
    return show_error("You cannot do this operation in single user mode!");
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<mount_efi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    0xe87(%rip),%rax
mov    %rax,-0x23(%rbp)
mov    0xe85(%rip),%eax
mov    %eax,-0x1b(%rbp)
mov    0xe7f(%rip),%ax
mov    %ax,-0x17(%rbp)
mov    0xe77(%rip),%al
mov    %al,-0x15(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11ea <mount_efi+0x8a>
lea    0xe64(%rip),%rdi
call   1030 <system@plt>
cmp    $0x0,%rax
je     11ce <mount_efi+0x6e>
lea    0xe5c(%rip),%rdi
call   1070 <show_error@plt>
mov    %eax,-0x4(%rbp)
jmp    129a <mount_efi+0x13a>
lea    0xe7a(%rip),%rdi
call   1040 <printf@plt>
lea    -0x23(%rbp),%rsi
lea    0xedc(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x10(%rbp),%rdi
lea    0xea2(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1222 <mount_efi+0xc2>
lea    -0x150(%rbp),%rdi
lea    -0x23(%rbp),%rdx
lea    0xe82(%rip),%rsi
mov    $0x0,%al
call   1080 <sprintf@plt>
jmp    1264 <mount_efi+0x104>
lea    -0x150(%rbp),%rdi
lea    -0x23(%rbp),%rdx
lea    0xe76(%rip),%rsi
mov    $0x0,%al
call   1080 <sprintf@plt>
lea    -0x150(%rbp),%rdi
call   1030 <system@plt>
lea    -0x150(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    -0x23(%rbp),%rcx
lea    0xe67(%rip),%rsi
mov    $0x0,%al
call   1080 <sprintf@plt>
lea    -0x150(%rbp),%rdi
call   1030 <system@plt>
cmp    $0x0,%rax
je     128e <mount_efi+0x12e>
lea    0xd9c(%rip),%rdi
call   1070 <show_error@plt>
mov    %eax,-0x4(%rbp)
jmp    129a <mount_efi+0x13a>
mov    0x2d4b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mount_efi>:
push   %r15
push   %r14
push   %rbx
sub    $0x140,%rsp
mov    %rdi,%rbx
movabs $0x3173306b736964,%rax
mov    %rax,(%rsp)
movq   $0x0,0x7(%rsp)
test   %esi,%esi
je     11ce <mount_efi+0x6e>
lea    0xe7e(%rip),%rdi
call   1030 <system@plt>
test   %rax,%rax
je     11b3 <mount_efi+0x53>
lea    0xe7b(%rip),%rdi
add    $0x140,%rsp
pop    %rbx
pop    %r14
pop    %r15
jmp    1070 <show_error@plt>
lea    0xe95(%rip),%rdi
call   1040 <printf@plt>
lea    0xefb(%rip),%rdi
mov    %rsp,%rsi
call   1060 <scanf@plt>
lea    0xec2(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     121f <mount_efi+0xbf>
lea    0xec1(%rip),%rsi
lea    0x10(%rsp),%r14
mov    %rsp,%r15
mov    %r14,%rdi
mov    %r15,%rdx
xor    %eax,%eax
call   1080 <sprintf@plt>
mov    %r14,%rdi
call   1030 <system@plt>
lea    0xeb7(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
mov    %r15,%rcx
xor    %eax,%eax
call   1080 <sprintf@plt>
jmp    1235 <mount_efi+0xd5>
lea    0xe72(%rip),%rsi
lea    0x10(%rsp),%rdi
mov    %rsp,%rdx
xor    %eax,%eax
call   1080 <sprintf@plt>
lea    0x10(%rsp),%rdi
call   1030 <system@plt>
test   %rax,%rax
je     1252 <mount_efi+0xf2>
lea    0xdd2(%rip),%rdi
call   1070 <show_error@plt>
jmp    125b <mount_efi+0xfb>
mov    0x2d87(%rip),%rax
mov    (%rax),%eax
add    $0x140,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.mount_efi._identifier = [15 x i8] c"disk0s1\00\00\00\00\00\00\00\00"
@.str = [14 x i8] c"diskutil list\00"
@.str.1 = [50 x i8] c"You cannot do this operation in single user mode!\00"
@.str.2 = [73 x i8] c"Enter the IDENTIFIER of the EFI partition to be mounted (e.g: disk0s1): \00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [18 x i8] c"diskutil mount %s\00"
@.str.6 = [26 x i8] c"diskutil unmount force %s\00"
@.str.7 = [33 x i8] c"diskutil mount -mountPoint %s %s\00"
@EXIT_SUCCESS = global i32 0
define i32 @mount_efi(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca [15 x i8]
%7 = alloca [300 x i8]
store i8* %0, i8** %4
store i32 %1, i32* %5
%8 = bitcast [15 x i8]* %6 to i8*
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %20
11: ; preds = %2
%12 = call i64 @system(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 @show_error(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
store i32 %15, i32* %3
br label %46
16: ; preds = %11
%17 = call i32 @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.2, i64 0, i64 0))
%18 = getelementptr inbounds [15 x i8], [15 x i8]* %6, i64 0, i64 0
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %18)
br label %20
20: ; preds = %16, %2
%21 = load i8*, i8** %4
%22 = call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %20
%25 = getelementptr inbounds [300 x i8], [300 x i8]* %7, i64 0, i64 0
%26 = getelementptr inbounds [15 x i8], [15 x i8]* %6, i64 0, i64 0
%27 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %25, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i8* %26)
br label %38
28: ; preds = %20
%29 = getelementptr inbounds [300 x i8], [300 x i8]* %7, i64 0, i64 0
%30 = getelementptr inbounds [15 x i8], [15 x i8]* %6, i64 0, i64 0
%31 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %29, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %30)
%32 = getelementptr inbounds [300 x i8], [300 x i8]* %7, i64 0, i64 0
%33 = call i64 @system(i8* %32)
%34 = getelementptr inbounds [300 x i8], [300 x i8]* %7, i64 0, i64 0
%35 = load i8*, i8** %4
%36 = getelementptr inbounds [15 x i8], [15 x i8]* %6, i64 0, i64 0
%37 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %34, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0), i8* %35, i8* %36)
br label %38
38: ; preds = %28, %24
%39 = getelementptr inbounds [300 x i8], [300 x i8]* %7, i64 0, i64 0
%40 = call i64 @system(i8* %39)
%41 = icmp ne i64 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %38
%43 = call i32 @show_error(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
store i32 %43, i32* %3
br label %46
44: ; preds = %38
%45 = load i32, i32* @EXIT_SUCCESS
store i32 %45, i32* %3
br label %46
46: ; preds = %44, %42, %14
%47 = load i32, i32* %3
ret i32 %47
}

LLVM IR (-O2):
@__const.mount_efi._identifier = [15 x i8] c"disk0s1\00\00\00\00\00\00\00\00"
@.str = [14 x i8] c"diskutil list\00"
@.str.1 = [50 x i8] c"You cannot do this operation in single user mode!\00"
@.str.2 = [73 x i8] c"Enter the IDENTIFIER of the EFI partition to be mounted (e.g: disk0s1): \00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [18 x i8] c"diskutil mount %s\00"
@.str.6 = [26 x i8] c"diskutil unmount force %s\00"
@.str.7 = [33 x i8] c"diskutil mount -mountPoint %s %s\00"
@EXIT_SUCCESS = global i32 0
define i32 @mount_efi(i8* %0, i32 %1) {
%3 = alloca [15 x i8]
%4 = alloca [300 x i8]
%5 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [300 x i8], [300 x i8]* %4, i64 0, i64 0
%7 = icmp eq i32 %1, 0
br i1 %7, label %16, label %8
8: ; preds = %2
%9 = tail call i64 @system(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %8
%12 = tail call i32 @show_error(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
br label %32
13: ; preds = %8
%14 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %5)
br label %16
16: ; preds = %13, %2
%17 = call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i8* %5)
br label %25
21: ; preds = %16
%22 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %5)
%23 = call i64 @system(i8* %6)
%24 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0), i8* %0, i8* %5)
br label %25
25: ; preds = %21, %19
%26 = call i64 @system(i8* %6)
%27 = icmp eq i64 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %25
%29 = call i32 @show_error(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
br label %32
30: ; preds = %25
%31 = load i32, i32* @EXIT_SUCCESS
br label %32
32: ; preds = %30, %28, %11
%33 = phi i32 [ %12, %11 ], [ %29, %28 ], [ %31, %30 ]
ret i32 %33
}