#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*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ make_fs(char *);
scalar_t__ mount_fs(char *);
int /*<<< orphan*/ stderr;
scalar_t__ umount_fs(char *);
int test_fs_creation() {
  if (make_fs("test.fs")) {
    fprintf(stderr, "test_fs_creation: FS creation failed.\n");
    return -1;
  }
  if (mount_fs("test.fs")) {
    fprintf(stderr, "test_fs_creation: Mount failed.\n");
    return -1;
  }
  if (umount_fs("test.fs")) {
    fprintf(stderr, "test_fs_creation: Unmount failed.\n");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<test_fs_creation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
call   1030 <make_fs@plt>
cmp    $0x0,%rax
je     117f <test_fs_creation+0x3f>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
lea    0xe9a(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11f4 <test_fs_creation+0xb4>
lea    0xe7a(%rip),%rdi
call   1060 <mount_fs@plt>
cmp    $0x0,%rax
je     11b6 <test_fs_creation+0x76>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
lea    0xe8a(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11f4 <test_fs_creation+0xb4>
lea    0xe43(%rip),%rdi
call   1040 <umount_fs@plt>
cmp    $0x0,%rax
je     11ed <test_fs_creation+0xad>
mov    0x2e0d(%rip),%rax
mov    (%rax),%edi
lea    0xe74(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11f4 <test_fs_creation+0xb4>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_fs_creation>:
push   %rax
lea    0xeb8(%rip),%rdi
call   1030 <make_fs@plt>
test   %rax,%rax
je     115b <test_fs_creation+0x1b>
lea    0xeaf(%rip),%rsi
jmp    118d <test_fs_creation+0x4d>
lea    0xe9e(%rip),%rdi
call   1060 <mount_fs@plt>
test   %rax,%rax
je     1175 <test_fs_creation+0x35>
lea    0xebc(%rip),%rsi
jmp    118d <test_fs_creation+0x4d>
lea    0xe84(%rip),%rdi
call   1040 <umount_fs@plt>
test   %rax,%rax
je     11a2 <test_fs_creation+0x62>
lea    0xec3(%rip),%rsi
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
call   1050 <fprintf@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"test.fs\00"
@stderr = global i32 0
@.str.1 = [39 x i8] c"test_fs_creation: FS creation failed.\0A\00"
@.str.2 = [33 x i8] c"test_fs_creation: Mount failed.\0A\00"
@.str.3 = [35 x i8] c"test_fs_creation: Unmount failed.\0A\00"
define i32 @test_fs_creation() {
%1 = alloca i32
%2 = call i64 @make_fs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %0
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %1
br label %20
7: ; preds = %0
%8 = call i64 @mount_fs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %1
br label %20
13: ; preds = %7
%14 = call i64 @umount_fs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = load i32, i32* @stderr
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %1
br label %20
19: ; preds = %13
store i32 0, i32* %1
br label %20
20: ; preds = %19, %16, %10, %4
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
@.str = [8 x i8] c"test.fs\00"
@stderr = global i32 0
@.str.1 = [39 x i8] c"test_fs_creation: FS creation failed.\0A\00"
@.str.2 = [33 x i8] c"test_fs_creation: Mount failed.\0A\00"
@.str.3 = [35 x i8] c"test_fs_creation: Unmount failed.\0A\00"
define i32 @test_fs_creation() {
%1 = tail call i64 @make_fs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %9
3: ; preds = %0
%4 = tail call i64 @mount_fs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i64 @umount_fs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %6, %3, %0
%10 = phi i8* [ getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), %0 ], [ getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), %6 ]
%11 = load i32, i32* @stderr
%12 = tail call i32 @fprintf(i32 %11, i8* %10)
br label %13
13: ; preds = %9, %6
%14 = phi i32 [ 0, %6 ], [ -1, %9 ]
ret i32 %14
}