#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*/ a_button();
int /*<<< orphan*/ system(char *);
int main() {
  system("mkdir /mnt/user/tmpusb");
  system("mount /dev/sdb1 /mnt/user/tmpusb -t vfat");
  system("sh /mnt/user/tmpusb/install_script");
  system("umount /dev/sdb1");
  while (!a_button()) {
  }
  system("sh /mnt/user/install_script_p2");
  system("rm /mnt/user/install_script_p2");
  system("rm -Rf /mnt/user/tmpusb");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1040 <system@plt>
lea    0xed5(%rip),%rdi
call   1040 <system@plt>
lea    0xef2(%rip),%rdi
call   1040 <system@plt>
lea    0xf09(%rip),%rdi
call   1040 <system@plt>
mov    $0x0,%al
call   1030 <a_button@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    117b <main+0x5b>
jmp    1180 <main+0x60>
jmp    115f <main+0x3f>
lea    0xeed(%rip),%rdi
call   1040 <system@plt>
lea    0xf00(%rip),%rdi
call   1040 <system@plt>
lea    0xf13(%rip),%rdi
call   1040 <system@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <system@plt>
lea    0xee3(%rip),%rdi
call   1040 <system@plt>
lea    0xf00(%rip),%rdi
call   1040 <system@plt>
lea    0xf17(%rip),%rdi
call   1040 <system@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <a_button@plt>
test   %eax,%eax
je     1160 <main+0x40>
lea    0xf02(%rip),%rdi
call   1040 <system@plt>
lea    0xf15(%rip),%rdi
call   1040 <system@plt>
lea    0xf28(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"mkdir /mnt/user/tmpusb\00"
@.str.1 = [41 x i8] c"mount /dev/sdb1 /mnt/user/tmpusb -t vfat\00"
@.str.2 = [35 x i8] c"sh /mnt/user/tmpusb/install_script\00"
@.str.3 = [17 x i8] c"umount /dev/sdb1\00"
@.str.4 = [31 x i8] c"sh /mnt/user/install_script_p2\00"
@.str.5 = [31 x i8] c"rm /mnt/user/install_script_p2\00"
@.str.6 = [24 x i8] c"rm -Rf /mnt/user/tmpusb\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @system(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @system(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @system(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @system(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %6
6: ; preds = %10, %0
%7 = call i32 (...) @a_button()
%8 = icmp ne i32 %7, 0
%9 = xor i1 %8, true
br i1 %9, label %10, label %11
10: ; preds = %6
br label %6
11: ; preds = %6
%12 = call i32 @system(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 @system(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
%14 = call i32 @system(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
@.str = [23 x i8] c"mkdir /mnt/user/tmpusb\00"
@.str.1 = [41 x i8] c"mount /dev/sdb1 /mnt/user/tmpusb -t vfat\00"
@.str.2 = [35 x i8] c"sh /mnt/user/tmpusb/install_script\00"
@.str.3 = [17 x i8] c"umount /dev/sdb1\00"
@.str.4 = [31 x i8] c"sh /mnt/user/install_script_p2\00"
@.str.5 = [31 x i8] c"rm /mnt/user/install_script_p2\00"
@.str.6 = [24 x i8] c"rm -Rf /mnt/user/tmpusb\00"
define i32 @main() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @system(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @system(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @system(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %5
5: ; preds = %5, %0
%6 = tail call i32 (...) @a_button()
%7 = icmp eq i32 %6, 0
br i1 %7, label %5, label %8
8: ; preds = %5
%9 = tail call i32 @system(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
%10 = tail call i32 @system(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
%11 = tail call i32 @system(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}