#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*/ EXIT_FAILURE;
unsigned int atoi(char *);
int /*<<< orphan*/ check_disk();
int /*<<< orphan*/ display_mbr();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ init_master();
int /*<<< orphan*/ load_mbr();
int /*<<< orphan*/ print_usage(char **);
int /*<<< orphan*/ printf(char *, ...);
int rmvol(unsigned int);
int /*<<< orphan*/ save_mbr();
int /*<<< orphan*/ scanf(char *, char *);
int main(int argc, char **argv) {
  unsigned int i;
  char ch;
  init_master();
  check_disk();
  load_mbr();
  if (argc < 2) {
    print_usage(argv);
    exit(EXIT_FAILURE);
  }
  i = atoi(argv[1]);
  if (rmvol(i) != -1) {
    display_mbr();
    printf("Voulez vous sauvegarder les changements ? [O/n]\n");
    (void)scanf(" %c", &ch);
    if (ch != 'n' && ch != 'N')
      save_mbr();
    else
      printf("Aucun changement effectue.\n");
  } else {
    printf("la partition %i n'est pas presente\n", i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <init_master@plt>
mov    $0x0,%al
call   1040 <check_disk@plt>
mov    $0x0,%al
call   1090 <load_mbr@plt>
cmpl   $0x2,-0x8(%rbp)
jge    11fc <main+0x4c>
mov    -0x10(%rbp),%rdi
call   10c0 <print_usage@plt>
mov    0x2deb(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1070 <rmvol@plt>
cmp    $0xffffffff,%eax
je     127b <main+0xcb>
mov    $0x0,%al
call   10d0 <display_mbr@plt>
lea    0xdd5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdf8(%rip),%rdi
lea    -0x15(%rbp),%rsi
call   1080 <scanf@plt>
movsbl -0x15(%rbp),%eax
cmp    $0x6e,%eax
je     1268 <main+0xb8>
movsbl -0x15(%rbp),%eax
cmp    $0x4e,%eax
je     1268 <main+0xb8>
mov    $0x0,%al
call   1060 <save_mbr@plt>
jmp    1276 <main+0xc6>
lea    0xdc6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    128c <main+0xdc>
mov    -0x14(%rbp),%esi
lea    0xdcc(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <init_master@plt>
xor    %eax,%eax
call   1050 <check_disk@plt>
xor    %eax,%eax
call   10a0 <load_mbr@plt>
cmp    $0x1,%ebp
jle    1257 <main+0x97>
mov    0x8(%rbx),%rdi
call   10b0 <atoi@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   1080 <rmvol@plt>
cmp    $0xffffffff,%eax
je     1235 <main+0x75>
xor    %eax,%eax
call   10e0 <display_mbr@plt>
lea    0xe21(%rip),%rdi
call   1040 <puts@plt>
lea    0xded(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1090 <scanf@plt>
mov    0x7(%rsp),%al
and    $0xdf,%al
cmp    $0x4e,%al
jne    1247 <main+0x87>
lea    0xe2a(%rip),%rdi
call   1040 <puts@plt>
jmp    124e <main+0x8e>
lea    0xdc8(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    124e <main+0x8e>
xor    %eax,%eax
call   1070 <save_mbr@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    %rbx,%rdi
call   10d0 <print_usage@plt>
mov    0x2d7a(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@.str = [49 x i8] c"Voulez vous sauvegarder les changements ? [O/n]\0A\00"
@.str.1 = [4 x i8] c" %c\00"
@.str.2 = [28 x i8] c"Aucun changement effectue.\0A\00"
@.str.3 = [36 x i8] c"la partition %i n'est pas presente\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 (...) @init_master()
%9 = call i32 (...) @check_disk()
%10 = call i32 (...) @load_mbr()
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 2
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = call i32 @print_usage(i8** %14)
%16 = load i32, i32* @EXIT_FAILURE
%17 = call i32 @exit(i32 %16)
unreachable
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @atoi(i8* %21)
store i32 %22, i32* %6
%23 = load i32, i32* %6
%24 = call i32 @rmvol(i32 %23)
%25 = icmp ne i32 %24, -1
br i1 %25, label %26, label %42
26: ; preds = %18
%27 = call i32 (...) @display_mbr()
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%29 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%30 = load i8, i8* %7
%31 = sext i8 %30 to i32
%32 = icmp ne i32 %31, 110
br i1 %32, label %33, label %39
33: ; preds = %26
%34 = load i8, i8* %7
%35 = sext i8 %34 to i32
%36 = icmp ne i32 %35, 78
br i1 %36, label %37, label %39
37: ; preds = %33
%38 = call i32 (...) @save_mbr()
br label %41
39: ; preds = %33, %26
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
br label %41
41: ; preds = %39, %37
br label %45
42: ; preds = %18
%43 = load i32, i32* %6
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %43)
br label %45
45: ; preds = %42, %41
ret i32 0
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str.1 = [4 x i8] c" %c\00"
@.str.3 = [36 x i8] c"la partition %i n'est pas presente\0A\00"
@str = [48 x i8] c"Voulez vous sauvegarder les changements ? [O/n]\00"
@str.4 = [27 x i8] c"Aucun changement effectue.\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i8
%4 = tail call i32 (...) @init_master()
%5 = tail call i32 (...) @check_disk()
%6 = tail call i32 (...) @load_mbr()
%7 = icmp slt i32 %0, 2
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = tail call i32 @print_usage(i8** %1)
%10 = load i32, i32* @EXIT_FAILURE
%11 = tail call i32 @exit(i32 %10)
unreachable
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = tail call i32 @atoi(i8* %14)
%16 = tail call i32 @rmvol(i32 %15)
%17 = icmp eq i32 %16, -1
br i1 %17, label %29, label %18
18: ; preds = %12
%19 = tail call i32 (...) @display_mbr()
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%21 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%22 = load i8, i8* %3
%23 = and i8 %22, -33
%24 = icmp eq i8 %23, 78
br i1 %24, label %27, label %25
25: ; preds = %18
%26 = call i32 (...) @save_mbr()
br label %31
27: ; preds = %18
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.4, i64 0, i64 0))
br label %31
29: ; preds = %12
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %15)
br label %31
31: ; preds = %25, %27, %29
ret i32 0
}