#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 */
typedef int /*<<< orphan*/ target;
typedef int /*<<< orphan*/ source;
typedef int /*<<< orphan*/ filesystem;

/* Variables and functions */
int atoi(char *);
int errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, int);
scalar_t__ mount(char *, char *, char *, int /*<<< orphan*/,
                 int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strncpy(char *, char *, int);
scalar_t__ umount(char *);
int main(int argc, char *argv[]) {
  char source[1024];
  char target[1024];
  char filesystem[1024];
  int runs;
  if (argc == 5) {
    strncpy(source, argv[1], sizeof(source));
    strncpy(target, argv[2], sizeof(target));
    strncpy(filesystem, argv[3], sizeof(filesystem));
    runs = atoi(argv[4]);
  } else {
    return 3;
  }
  for (; runs > 0; runs--) {
    do {
      if (mount(source, target, filesystem, 0, 0)) {
        fprintf(stderr, "Fail code %d - %d!\n", 4, errno);
        return 4;
      }
    } while (0);
    do {
      if (umount(target)) {
        fprintf(stderr, "Fail code %d - %d!\n", 5, errno);
        return 5;
      }
    } while (0);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x5,-0x8(%rbp)
jne    11d6 <main+0x86>
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    $0x400,%edx
call   1030 <strncpy@plt>
lea    -0x810(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
mov    $0x400,%edx
call   1030 <strncpy@plt>
lea    -0xc10(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
mov    $0x400,%edx
call   1030 <strncpy@plt>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0xc14(%rbp)
jmp    11e2 <main+0x92>
movl   $0x3,-0x4(%rbp)
jmp    12c6 <main+0x176>
jmp    11e7 <main+0x97>
cmpl   $0x0,-0xc14(%rbp)
jle    12bf <main+0x16f>
jmp    11f9 <main+0xa9>
lea    -0x410(%rbp),%rdi
lea    -0x810(%rbp),%rsi
lea    -0xc10(%rbp),%rdx
xor    %r8d,%r8d
mov    %r8d,%ecx
call   1050 <mount@plt>
cmp    $0x0,%rax
je     1252 <main+0x102>
mov    0x2db6(%rip),%rax
mov    (%rax),%edi
mov    0x2da5(%rip),%rax
mov    (%rax),%ecx
lea    0xdc4(%rip),%rsi
mov    $0x4,%edx
call   1060 <fprintf@plt>
movl   $0x4,-0x4(%rbp)
jmp    12c6 <main+0x176>
jmp    1257 <main+0x107>
jmp    125c <main+0x10c>
lea    -0x810(%rbp),%rdi
call   1040 <umount@plt>
cmp    $0x0,%rax
je     12a1 <main+0x151>
mov    0x2d67(%rip),%rax
mov    (%rax),%edi
mov    0x2d56(%rip),%rax
mov    (%rax),%ecx
lea    0xd75(%rip),%rsi
mov    $0x5,%edx
call   1060 <fprintf@plt>
movl   $0x5,-0x4(%rbp)
jmp    12c6 <main+0x176>
jmp    12a6 <main+0x156>
jmp    12ab <main+0x15b>
mov    -0xc14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc14(%rbp)
jmp    11e7 <main+0x97>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0xc08,%rsp
mov    $0x3,%ebp
cmp    $0x5,%edi
jne    122d <main+0xdd>
mov    %rsi,%rbx
mov    0x8(%rsi),%rsi
lea    0x800(%rsp),%rdi
mov    $0x400,%edx
call   1030 <strncpy@plt>
mov    0x10(%rbx),%rsi
lea    0x400(%rsp),%rdi
mov    $0x400,%edx
call   1030 <strncpy@plt>
mov    0x18(%rbx),%rsi
mov    %rsp,%rdi
mov    $0x400,%edx
call   1030 <strncpy@plt>
mov    0x20(%rbx),%rdi
call   1070 <atoi@plt>
test   %eax,%eax
jle    11fd <main+0xad>
mov    %eax,%ebx
add    $0x1,%ebx
lea    0x800(%rsp),%r14
lea    0x400(%rsp),%rbp
mov    %rsp,%r15
mov    %r14,%rdi
mov    %rbp,%rsi
mov    %r15,%rdx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1050 <mount@plt>
test   %rax,%rax
jne    1201 <main+0xb1>
mov    %rbp,%rdi
call   1040 <umount@plt>
test   %rax,%rax
jne    1208 <main+0xb8>
add    $0xffffffff,%ebx
cmp    $0x2,%ebx
jge    11d0 <main+0x80>
xor    %ebp,%ebp
jmp    122d <main+0xdd>
mov    $0x4,%ebp
jmp    120d <main+0xbd>
mov    $0x5,%ebp
mov    0x2dcc(%rip),%rax
mov    (%rax),%edi
mov    0x2dbb(%rip),%rax
mov    (%rax),%ecx
lea    0xdda(%rip),%rsi
mov    %ebp,%edx
call   1060 <fprintf@plt>
mov    %ebp,%eax
add    $0xc08,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [20 x i8] c"Fail code %d - %d!\0A\00"
@errno = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1024 x i8]
%7 = alloca [1024 x i8]
%8 = alloca [1024 x i8]
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 5
br i1 %11, label %12, label %32
12: ; preds = %2
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @strncpy(i8* %13, i8* %16, i32 1024)
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 2
%21 = load i8*, i8** %20
%22 = call i32 @strncpy(i8* %18, i8* %21, i32 1024)
%23 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 3
%26 = load i8*, i8** %25
%27 = call i32 @strncpy(i8* %23, i8* %26, i32 1024)
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 4
%30 = load i8*, i8** %29
%31 = call i32 @atoi(i8* %30)
store i32 %31, i32* %9
br label %33
32: ; preds = %2
store i32 3, i32* %3
br label %64
33: ; preds = %12
br label %34
34: ; preds = %60, %33
%35 = load i32, i32* %9
%36 = icmp sgt i32 %35, 0
br i1 %36, label %37, label %63
37: ; preds = %34
br label %38
38: ; preds = %37
%39 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%40 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%41 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%42 = call i64 @mount(i8* %39, i8* %40, i8* %41, i32 0, i32 0)
%43 = icmp ne i64 %42, 0
br i1 %43, label %44, label %48
44: ; preds = %38
%45 = load i32, i32* @stderr
%46 = load i32, i32* @errno
%47 = call i32 @fprintf(i32 %45, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 4, i32 %46)
store i32 4, i32* %3
br label %64
48: ; preds = %38
br label %49
49: ; preds = %48
br label %50
50: ; preds = %49
%51 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%52 = call i64 @umount(i8* %51)
%53 = icmp ne i64 %52, 0
br i1 %53, label %54, label %58
54: ; preds = %50
%55 = load i32, i32* @stderr
%56 = load i32, i32* @errno
%57 = call i32 @fprintf(i32 %55, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 5, i32 %56)
store i32 5, i32* %3
br label %64
58: ; preds = %50
br label %59
59: ; preds = %58
br label %60
60: ; preds = %59
%61 = load i32, i32* %9
%62 = add nsw i32 %61, -1
store i32 %62, i32* %9
br label %34
63: ; preds = %34
store i32 0, i32* %3
br label %64
64: ; preds = %63, %54, %44, %32
%65 = load i32, i32* %3
ret i32 %65
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"Fail code %d - %d!\0A\00"
@errno = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca [1024 x i8]
%5 = alloca [1024 x i8]
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%9 = icmp eq i32 %0, 5
br i1 %9, label %10, label %39
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @strncpy(i8* %6, i8* %12, i32 1024)
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = call i32 @strncpy(i8* %7, i8* %15, i32 1024)
%17 = getelementptr inbounds i8*, i8** %1, i64 3
%18 = load i8*, i8** %17
%19 = call i32 @strncpy(i8* %8, i8* %18, i32 1024)
%20 = getelementptr inbounds i8*, i8** %1, i64 4
%21 = load i8*, i8** %20
%22 = call i32 @atoi(i8* %21)
%23 = icmp sgt i32 %22, 0
br i1 %23, label %27, label %39
24: ; preds = %31
%25 = add nsw i32 %28, -1
%26 = icmp sgt i32 %28, 1
br i1 %26, label %27, label %39
27: ; preds = %10, %24
%28 = phi i32 [ %25, %24 ], [ %22, %10 ]
%29 = call i64 @mount(i8* %6, i8* %7, i8* %8, i32 0, i32 0)
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %27
%32 = call i64 @umount(i8* %7)
%33 = icmp eq i64 %32, 0
br i1 %33, label %24, label %34
34: ; preds = %31, %27
%35 = phi i32 [ 4, %27 ], [ 5, %31 ]
%36 = load i32, i32* @stderr
%37 = load i32, i32* @errno
%38 = call i32 @fprintf(i32 %36, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %35, i32 %37)
br label %39
39: ; preds = %24, %34, %10, %2
%40 = phi i32 [ 3, %2 ], [ 0, %10 ], [ %35, %34 ], [ 0, %24 ]
ret i32 %40
}