#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 mount(char *, char *, char *, int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char **argv) {
  if (argc < 3 || argc > 4) {
    printf("usage: %s fs [src] dst\n", argv[0]);
    return -1;
  }
  char *fs = argv[1];
  char *dst = argc == 4 ? argv[3] : argv[2];
  char *src = argc == 4 ? argv[2] : NULL;
  switch (mount(src, dst, fs, 0, NULL)) {
  case -2:
    printf("unkown filesystem: %s\n", fs);
    return -2;
  case -3:
    printf("destination not found: %s\n", dst);
    return -3;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jl     114a <main+0x2a>
cmpl   $0x4,-0x8(%rbp)
jle    1169 <main+0x49>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xea8(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    123f <main+0x11f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x4,-0x8(%rbp)
jne    1190 <main+0x70>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x30(%rbp)
jmp    119c <main+0x7c>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpl   $0x4,-0x8(%rbp)
jne    11bf <main+0x9f>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x38(%rbp)
jmp    11ca <main+0xaa>
xor    %eax,%eax
mov    %rax,-0x38(%rbp)
jmp    11ca <main+0xaa>
mov    -0x38(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
xor    %ecx,%ecx
mov    %ecx,%r8d
call   1030 <mount@plt>
mov    %eax,%ecx
mov    %ecx,-0x3c(%rbp)
sub    $0xfffffffd,%eax
je     1228 <main+0x108>
jmp    11fb <main+0xdb>
mov    -0x3c(%rbp),%eax
sub    $0xfffffffe,%eax
jne    123f <main+0x11f>
jmp    120c <main+0xec>
mov    -0x18(%rbp),%rsi
lea    0xe01(%rip),%rdi
call   1040 <printf@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    123f <main+0x11f>
mov    -0x20(%rbp),%rsi
lea    0xdfc(%rip),%rdi
call   1040 <printf@plt>
movl   $0xfffffffd,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
lea    -0x5(%rdi),%eax
cmp    $0xfffffffd,%eax
ja     1143 <main+0x23>
mov    (%rsi),%rsi
lea    0xec9(%rip),%rdi
call   1040 <printf@plt>
mov    $0xffffffff,%ebx
jmp    11a4 <main+0x84>
mov    0x8(%rsi),%r14
xor    %ebx,%ebx
xor    %eax,%eax
cmp    $0x4,%edi
sete   %al
mov    0x10(%rsi,%rax,8),%r15
jne    115e <main+0x3e>
mov    0x10(%rsi),%rdi
jmp    1160 <main+0x40>
xor    %edi,%edi
mov    %r15,%rsi
mov    %r14,%rdx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <mount@plt>
cmp    $0xfffffffd,%eax
je     1190 <main+0x70>
cmp    $0xfffffffe,%eax
jne    11a4 <main+0x84>
lea    0xe97(%rip),%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
mov    $0xfffffffe,%ebx
jmp    11a4 <main+0x84>
lea    0xe98(%rip),%rdi
mov    %r15,%rsi
call   1040 <printf@plt>
mov    $0xfffffffd,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [24 x i8] c"usage: %s fs [src] dst\0A\00"
@.str.1 = [23 x i8] c"unkown filesystem: %s\0A\00"
@.str.2 = [27 x i8] c"destination not found: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 3
br i1 %10, label %14, label %11
11: ; preds = %2
%12 = load i32, i32* %4
%13 = icmp sgt i32 %12, 4
br i1 %13, label %14, label %19
14: ; preds = %11, %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %17)
store i32 -1, i32* %3
br label %54
19: ; preds = %11
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
store i8* %22, i8** %6
%23 = load i32, i32* %4
%24 = icmp eq i32 %23, 4
br i1 %24, label %25, label %29
25: ; preds = %19
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 3
%28 = load i8*, i8** %27
br label %33
29: ; preds = %19
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 2
%32 = load i8*, i8** %31
br label %33
33: ; preds = %29, %25
%34 = phi i8* [ %28, %25 ], [ %32, %29 ]
store i8* %34, i8** %7
%35 = load i32, i32* %4
%36 = icmp eq i32 %35, 4
br i1 %36, label %37, label %41
37: ; preds = %33
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 2
%40 = load i8*, i8** %39
br label %42
41: ; preds = %33
br label %42
42: ; preds = %41, %37
%43 = phi i8* [ %40, %37 ], [ null, %41 ]
store i8* %43, i8** %8
%44 = load i8*, i8** %8
%45 = load i8*, i8** %7
%46 = load i8*, i8** %6
%47 = call i32 @mount(i8* %44, i8* %45, i8* %46, i32 0, i32* null)
switch i32 %47, label %54 [
i32 -2, label %48
i32 -3, label %51
]
48: ; preds = %42
%49 = load i8*, i8** %6
%50 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %49)
store i32 -2, i32* %3
br label %54
51: ; preds = %42
%52 = load i8*, i8** %7
%53 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %52)
store i32 -3, i32* %3
br label %54
54: ; preds = %14, %48, %51, %42
%55 = load i32, i32* %3
ret i32 %55
}

LLVM IR (-O2):
@.str = [24 x i8] c"usage: %s fs [src] dst\0A\00"
@.str.1 = [23 x i8] c"unkown filesystem: %s\0A\00"
@.str.2 = [27 x i8] c"destination not found: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = add i32 %0, -5
%4 = icmp ult i32 %3, -2
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i8*, i8** %1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %25
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = icmp eq i32 %0, 4
%12 = getelementptr inbounds i8*, i8** %1, i64 3
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = select i1 %11, i8** %12, i8** %13
%15 = load i8*, i8** %14
br i1 %11, label %16, label %18
16: ; preds = %8
%17 = load i8*, i8** %13
br label %18
18: ; preds = %8, %16
%19 = phi i8* [ %17, %16 ], [ null, %8 ]
%20 = tail call i32 @mount(i8* %19, i8* %15, i8* %10, i32 0, i32* null)
switch i32 %20, label %25 [
i32 -2, label %21
i32 -3, label %23
]
21: ; preds = %18
%22 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %10)
br label %25
23: ; preds = %18
%24 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %15)
br label %25
25: ; preds = %21, %23, %18, %5
%26 = phi i32 [ -1, %5 ], [ -3, %23 ], [ -2, %21 ], [ 0, %18 ]
ret i32 %26
}