#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 */
scalar_t__ check_test_pattern(int, size_t);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ fs_close(int);
scalar_t__ fs_create(char *);
scalar_t__ fs_delete(char *);
int fs_open(char *);
scalar_t__ mount_fs(char *);
int /*<<< orphan*/ stderr;
scalar_t__ umount_fs(char *);
scalar_t__ write_test_pattern(int, size_t);
int test_file_write() {
  char *fname1 = "test_file_1";
  char *fname2 = "test_file_2";
  char *fname3 = "test_file_3";
  int fd = 0;
  int fd_unused = 0;
  size_t nbytes = 4096 * 3 + 42;
  if (mount_fs("test.fs")) {
    fprintf(stderr, "test_file_write: Mount failed.\n");
    return -1;
  }
  if (fs_create(fname1) || fs_create(fname2) || fs_create(fname3)) {
    fprintf(stderr, "test_file_write: File creation failed.\n");
    return -1;
  }
  if ((fd_unused = fs_open(fname1)) == -1 || (fd = fs_open(fname2)) == -1) {
    fprintf(stderr, "test_file_write: Failed to open files.\n");
    return -1;
  }
  if (write_test_pattern(fd, nbytes)) {
    fprintf(stderr, "test_file_write: Failed to write test pattern.\n");
    return -1;
  }
  if (fs_delete(fname3)) {
    fprintf(stderr, "test_file_write: Failed to delete unused file.\n");
    return -1;
  }
  if (fs_close(fd) || fs_close(fd_unused)) {
    fprintf(stderr, "test_file_write: Failed to close open files.\n");
    return -1;
  }
  if (umount_fs("test.fs")) {
    fprintf(stderr, "test_file_write: Unmount failed.\n");
    return -1;
  }
  if (mount_fs("test.fs")) {
    fprintf(stderr, "test_file_write: Mount failed.\n");
    return -1;
  }
  if ((fd = fs_open(fname2)) == -1) {
    fprintf(stderr, "test_file_write: Failed to re-open file.\n");
    return -1;
  }
  if (check_test_pattern(fd, nbytes)) {
    fprintf(stderr, "test_file_write: Test pattern check failed.\n");
    return -1;
  }
  if (fs_close(fd)) {
    fprintf(stderr, "test_file_write: Failed to close open file.\n");
    return -1;
  }
  if (fs_delete(fname1) || fs_delete(fname2)) {
    fprintf(stderr, "test_file_write: Failed to delete files.\n");
    return -1;
  }
  if (umount_fs("test.fs")) {
    fprintf(stderr, "test_file_write: Unmount failed.\n");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<test_file_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    0xe61(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xe62(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xe63(%rip),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movq   $0x302a,-0x30(%rbp)
lea    0xe4e(%rip),%rdi
call   10b0 <mount_fs@plt>
cmp    $0x0,%rax
je     1206 <test_file_write+0x76>
mov    0x2df4(%rip),%rax
mov    (%rax),%edi
lea    0xe37(%rip),%rsi
call   1090 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14ee <test_file_write+0x35e>
mov    -0x10(%rbp),%rdi
call   1040 <fs_create@plt>
cmp    $0x0,%rax
jne    123f <test_file_write+0xaf>
mov    -0x18(%rbp),%rdi
call   1040 <fs_create@plt>
cmp    $0x0,%rax
jne    123f <test_file_write+0xaf>
mov    -0x20(%rbp),%rdi
call   1040 <fs_create@plt>
cmp    $0x0,%rax
je     1260 <test_file_write+0xd0>
mov    0x2d9a(%rip),%rax
mov    (%rax),%edi
lea    0xdfd(%rip),%rsi
call   1090 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14ee <test_file_write+0x35e>
mov    -0x10(%rbp),%rdi
call   1030 <fs_open@plt>
mov    %eax,-0x28(%rbp)
cmp    $0xffffffff,%eax
je     128a <test_file_write+0xfa>
mov    -0x18(%rbp),%rdi
call   1030 <fs_open@plt>
mov    %eax,-0x24(%rbp)
cmp    $0xffffffff,%eax
jne    12ab <test_file_write+0x11b>
mov    0x2d4f(%rip),%rax
mov    (%rax),%edi
lea    0xdda(%rip),%rsi
call   1090 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14ee <test_file_write+0x35e>
mov    -0x24(%rbp),%edi
mov    -0x30(%rbp),%rsi
call   1050 <write_test_pattern@plt>
cmp    $0x0,%rax
je     12e2 <test_file_write+0x152>
mov    0x2d18(%rip),%rax
mov    (%rax),%edi
lea    0xdcb(%rip),%rsi
call   1090 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14ee <test_file_write+0x35e>
mov    -0x20(%rbp),%rdi
call   10a0 <fs_delete@plt>
cmp    $0x0,%rax
je     1316 <test_file_write+0x186>
mov    0x2ce4(%rip),%rax
mov    (%rax),%edi
lea    0xdc7(%rip),%rsi
call   1090 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14ee <test_file_write+0x35e>
mov    -0x24(%rbp),%edi
call   1070 <fs_close@plt>
cmp    $0x0,%rax
jne    133a <test_file_write+0x1aa>
mov    -0x28(%rbp),%edi
call   1070 <fs_close@plt>
cmp    $0x0,%rax
je     135b <test_file_write+0x1cb>
mov    0x2c9f(%rip),%rax
mov    (%rax),%edi
lea    0xdb2(%rip),%rsi
call   1090 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14ee <test_file_write+0x35e>
lea    0xcc2(%rip),%rdi
call   1080 <umount_fs@plt>
cmp    $0x0,%rax
je     1392 <test_file_write+0x202>
mov    0x2c68(%rip),%rax
mov    (%rax),%edi
lea    0xda9(%rip),%rsi
call   1090 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14ee <test_file_write+0x35e>
lea    0xc8b(%rip),%rdi
call   10b0 <mount_fs@plt>
cmp    $0x0,%rax
je     13c9 <test_file_write+0x239>
mov    0x2c31(%rip),%rax
mov    (%rax),%edi
lea    0xc74(%rip),%rsi
call   1090 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14ee <test_file_write+0x35e>
mov    -0x18(%rbp),%rdi
call   1030 <fs_open@plt>
mov    %eax,-0x24(%rbp)
cmp    $0xffffffff,%eax
jne    13ff <test_file_write+0x26f>
mov    0x2bfb(%rip),%rax
mov    (%rax),%edi
lea    0xd5e(%rip),%rsi
call   1090 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14ee <test_file_write+0x35e>
mov    -0x24(%rbp),%edi
mov    -0x30(%rbp),%rsi
call   1060 <check_test_pattern@plt>
cmp    $0x0,%rax
je     1436 <test_file_write+0x2a6>
mov    0x2bc4(%rip),%rax
mov    (%rax),%edi
lea    0xd51(%rip),%rsi
call   1090 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14ee <test_file_write+0x35e>
mov    -0x24(%rbp),%edi
call   1070 <fs_close@plt>
cmp    $0x0,%rax
je     1469 <test_file_write+0x2d9>
mov    0x2b91(%rip),%rax
mov    (%rax),%edi
lea    0xd4b(%rip),%rsi
call   1090 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14ee <test_file_write+0x35e>
mov    -0x10(%rbp),%rdi
call   10a0 <fs_delete@plt>
cmp    $0x0,%rax
jne    148f <test_file_write+0x2ff>
mov    -0x18(%rbp),%rdi
call   10a0 <fs_delete@plt>
cmp    $0x0,%rax
je     14b0 <test_file_write+0x320>
mov    0x2b4a(%rip),%rax
mov    (%rax),%edi
lea    0xd31(%rip),%rsi
call   1090 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14ee <test_file_write+0x35e>
lea    0xb6d(%rip),%rdi
call   1080 <umount_fs@plt>
cmp    $0x0,%rax
je     14e7 <test_file_write+0x357>
mov    0x2b13(%rip),%rax
mov    (%rax),%edi
lea    0xc54(%rip),%rsi
call   1090 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14ee <test_file_write+0x35e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_file_write>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xe86(%rip),%rdi
call   10b0 <mount_fs@plt>
lea    0xe82(%rip),%rbp
test   %rax,%rax
je     11b4 <test_file_write+0x24>
mov    %rbp,%rbx
jmp    11ee <test_file_write+0x5e>
lea    0xe45(%rip),%rdi
call   1040 <fs_create@plt>
lea    0xe85(%rip),%rbx
test   %rax,%rax
jne    11ee <test_file_write+0x5e>
lea    0xe39(%rip),%rdi
call   1040 <fs_create@plt>
test   %rax,%rax
jne    11ee <test_file_write+0x5e>
lea    0xe34(%rip),%rdi
call   1040 <fs_create@plt>
test   %rax,%rax
je     120f <test_file_write+0x7f>
mov    0x2deb(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
call   1090 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xdea(%rip),%rdi
call   1030 <fs_open@plt>
lea    0xe52(%rip),%rbx
cmp    $0xffffffff,%eax
je     11ee <test_file_write+0x5e>
mov    %eax,%r14d
lea    0xddb(%rip),%rdi
call   1030 <fs_open@plt>
cmp    $0xffffffff,%eax
je     11ee <test_file_write+0x5e>
mov    %eax,%r15d
mov    $0x302a,%esi
mov    %eax,%edi
call   1050 <write_test_pattern@plt>
test   %rax,%rax
je     1258 <test_file_write+0xc8>
lea    0xe46(%rip),%rbx
jmp    11ee <test_file_write+0x5e>
lea    0xdb9(%rip),%rdi
call   10a0 <fs_delete@plt>
test   %rax,%rax
je     1275 <test_file_write+0xe5>
lea    0xe5c(%rip),%rbx
jmp    11ee <test_file_write+0x5e>
mov    %r15d,%edi
call   1070 <fs_close@plt>
lea    0xe78(%rip),%rbx
test   %rax,%rax
jne    11ee <test_file_write+0x5e>
mov    %r14d,%edi
call   1070 <fs_close@plt>
test   %rax,%rax
jne    11ee <test_file_write+0x5e>
lea    0xd7f(%rip),%rdi
call   1080 <umount_fs@plt>
lea    0xe79(%rip),%r14
test   %rax,%rax
je     12be <test_file_write+0x12e>
mov    %r14,%rbx
jmp    11ee <test_file_write+0x5e>
lea    0xd5f(%rip),%rdi
call   10b0 <mount_fs@plt>
mov    %rbp,%rbx
test   %rax,%rax
jne    11ee <test_file_write+0x5e>
lea    0xd2f(%rip),%rdi
call   1030 <fs_open@plt>
cmp    $0xffffffff,%eax
je     1306 <test_file_write+0x176>
mov    %eax,%ebx
mov    $0x302a,%esi
mov    %eax,%edi
call   1060 <check_test_pattern@plt>
test   %rax,%rax
je     1312 <test_file_write+0x182>
lea    0xe75(%rip),%rbx
jmp    11ee <test_file_write+0x5e>
lea    0xe3f(%rip),%rbx
jmp    11ee <test_file_write+0x5e>
mov    %ebx,%edi
call   1070 <fs_close@plt>
test   %rax,%rax
je     132a <test_file_write+0x19a>
lea    0xe7e(%rip),%rbx
jmp    11ee <test_file_write+0x5e>
lea    0xccf(%rip),%rdi
call   10a0 <fs_delete@plt>
lea    0xe93(%rip),%rbx
test   %rax,%rax
jne    11ee <test_file_write+0x5e>
lea    0xcbf(%rip),%rdi
call   10a0 <fs_delete@plt>
test   %rax,%rax
jne    11ee <test_file_write+0x5e>
lea    0xcc2(%rip),%rdi
call   1080 <umount_fs@plt>
mov    %r14,%rbx
test   %rax,%rax
jne    11ee <test_file_write+0x5e>
xor    %eax,%eax
jmp    1204 <test_file_write+0x74>

LLVM IR (-O0):
@.str = [12 x i8] c"test_file_1\00"
@.str.1 = [12 x i8] c"test_file_2\00"
@.str.2 = [12 x i8] c"test_file_3\00"
@.str.3 = [8 x i8] c"test.fs\00"
@stderr = global i32 0
@.str.4 = [32 x i8] c"test_file_write: Mount failed.\0A\00"
@.str.5 = [40 x i8] c"test_file_write: File creation failed.\0A\00"
@.str.6 = [40 x i8] c"test_file_write: Failed to open files.\0A\00"
@.str.7 = [48 x i8] c"test_file_write: Failed to write test pattern.\0A\00"
@.str.8 = [48 x i8] c"test_file_write: Failed to delete unused file.\0A\00"
@.str.9 = [46 x i8] c"test_file_write: Failed to close open files.\0A\00"
@.str.10 = [34 x i8] c"test_file_write: Unmount failed.\0A\00"
@.str.11 = [42 x i8] c"test_file_write: Failed to re-open file.\0A\00"
@.str.12 = [45 x i8] c"test_file_write: Test pattern check failed.\0A\00"
@.str.13 = [45 x i8] c"test_file_write: Failed to close open file.\0A\00"
@.str.14 = [42 x i8] c"test_file_write: Failed to delete files.\0A\00"
define i32 @test_file_write() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i64
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8** %3
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8** %4
store i32 0, i32* %5
store i32 0, i32* %6
store i64 12330, i64* %7
%8 = call i64 @mount_fs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %0
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %1
br label %117
13: ; preds = %0
%14 = load i8*, i8** %2
%15 = call i64 @fs_create(i8* %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %25, label %17
17: ; preds = %13
%18 = load i8*, i8** %3
%19 = call i64 @fs_create(i8* %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %25, label %21
21: ; preds = %17
%22 = load i8*, i8** %4
%23 = call i64 @fs_create(i8* %22)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %21, %17, %13
%26 = load i32, i32* @stderr
%27 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %1
br label %117
28: ; preds = %21
%29 = load i8*, i8** %2
%30 = call i32 @fs_open(i8* %29)
store i32 %30, i32* %6
%31 = icmp eq i32 %30, -1
br i1 %31, label %36, label %32
32: ; preds = %28
%33 = load i8*, i8** %3
%34 = call i32 @fs_open(i8* %33)
store i32 %34, i32* %5
%35 = icmp eq i32 %34, -1
br i1 %35, label %36, label %39
36: ; preds = %32, %28
%37 = load i32, i32* @stderr
%38 = call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0))
store i32 -1, i32* %1
br label %117
39: ; preds = %32
%40 = load i32, i32* %5
%41 = load i64, i64* %7
%42 = call i64 @write_test_pattern(i32 %40, i64 %41)
%43 = icmp ne i64 %42, 0
br i1 %43, label %44, label %47
44: ; preds = %39
%45 = load i32, i32* @stderr
%46 = call i32 @fprintf(i32 %45, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.7, i64 0, i64 0))
store i32 -1, i32* %1
br label %117
47: ; preds = %39
%48 = load i8*, i8** %4
%49 = call i64 @fs_delete(i8* %48)
%50 = icmp ne i64 %49, 0
br i1 %50, label %51, label %54
51: ; preds = %47
%52 = load i32, i32* @stderr
%53 = call i32 @fprintf(i32 %52, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.8, i64 0, i64 0))
store i32 -1, i32* %1
br label %117
54: ; preds = %47
%55 = load i32, i32* %5
%56 = call i64 @fs_close(i32 %55)
%57 = icmp ne i64 %56, 0
br i1 %57, label %62, label %58
58: ; preds = %54
%59 = load i32, i32* %6
%60 = call i64 @fs_close(i32 %59)
%61 = icmp ne i64 %60, 0
br i1 %61, label %62, label %65
62: ; preds = %58, %54
%63 = load i32, i32* @stderr
%64 = call i32 @fprintf(i32 %63, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.9, i64 0, i64 0))
store i32 -1, i32* %1
br label %117
65: ; preds = %58
%66 = call i64 @umount_fs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%67 = icmp ne i64 %66, 0
br i1 %67, label %68, label %71
68: ; preds = %65
%69 = load i32, i32* @stderr
%70 = call i32 @fprintf(i32 %69, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.10, i64 0, i64 0))
store i32 -1, i32* %1
br label %117
71: ; preds = %65
%72 = call i64 @mount_fs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%73 = icmp ne i64 %72, 0
br i1 %73, label %74, label %77
74: ; preds = %71
%75 = load i32, i32* @stderr
%76 = call i32 @fprintf(i32 %75, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %1
br label %117
77: ; preds = %71
%78 = load i8*, i8** %3
%79 = call i32 @fs_open(i8* %78)
store i32 %79, i32* %5
%80 = icmp eq i32 %79, -1
br i1 %80, label %81, label %84
81: ; preds = %77
%82 = load i32, i32* @stderr
%83 = call i32 @fprintf(i32 %82, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.11, i64 0, i64 0))
store i32 -1, i32* %1
br label %117
84: ; preds = %77
%85 = load i32, i32* %5
%86 = load i64, i64* %7
%87 = call i64 @check_test_pattern(i32 %85, i64 %86)
%88 = icmp ne i64 %87, 0
br i1 %88, label %89, label %92
89: ; preds = %84
%90 = load i32, i32* @stderr
%91 = call i32 @fprintf(i32 %90, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.12, i64 0, i64 0))
store i32 -1, i32* %1
br label %117
92: ; preds = %84
%93 = load i32, i32* %5
%94 = call i64 @fs_close(i32 %93)
%95 = icmp ne i64 %94, 0
br i1 %95, label %96, label %99
96: ; preds = %92
%97 = load i32, i32* @stderr
%98 = call i32 @fprintf(i32 %97, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.13, i64 0, i64 0))
store i32 -1, i32* %1
br label %117
99: ; preds = %92
%100 = load i8*, i8** %2
%101 = call i64 @fs_delete(i8* %100)
%102 = icmp ne i64 %101, 0
br i1 %102, label %107, label %103
103: ; preds = %99
%104 = load i8*, i8** %3
%105 = call i64 @fs_delete(i8* %104)
%106 = icmp ne i64 %105, 0
br i1 %106, label %107, label %110
107: ; preds = %103, %99
%108 = load i32, i32* @stderr
%109 = call i32 @fprintf(i32 %108, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.14, i64 0, i64 0))
store i32 -1, i32* %1
br label %117
110: ; preds = %103
%111 = call i64 @umount_fs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%112 = icmp ne i64 %111, 0
br i1 %112, label %113, label %116
113: ; preds = %110
%114 = load i32, i32* @stderr
%115 = call i32 @fprintf(i32 %114, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.10, i64 0, i64 0))
store i32 -1, i32* %1
br label %117
116: ; preds = %110
store i32 0, i32* %1
br label %117
117: ; preds = %116, %113, %107, %96, %89, %81, %74, %68, %62, %51, %44, %36, %25, %10
%118 = load i32, i32* %1
ret i32 %118
}

LLVM IR (-O2):
@.str = [12 x i8] c"test_file_1\00"
@.str.1 = [12 x i8] c"test_file_2\00"
@.str.2 = [12 x i8] c"test_file_3\00"
@.str.3 = [8 x i8] c"test.fs\00"
@stderr = global i32 0
@.str.4 = [32 x i8] c"test_file_write: Mount failed.\0A\00"
@.str.5 = [40 x i8] c"test_file_write: File creation failed.\0A\00"
@.str.6 = [40 x i8] c"test_file_write: Failed to open files.\0A\00"
@.str.7 = [48 x i8] c"test_file_write: Failed to write test pattern.\0A\00"
@.str.8 = [48 x i8] c"test_file_write: Failed to delete unused file.\0A\00"
@.str.9 = [46 x i8] c"test_file_write: Failed to close open files.\0A\00"
@.str.10 = [34 x i8] c"test_file_write: Unmount failed.\0A\00"
@.str.11 = [42 x i8] c"test_file_write: Failed to re-open file.\0A\00"
@.str.12 = [45 x i8] c"test_file_write: Test pattern check failed.\0A\00"
@.str.13 = [45 x i8] c"test_file_write: Failed to close open file.\0A\00"
@.str.14 = [42 x i8] c"test_file_write: Failed to delete files.\0A\00"
define i32 @test_file_write() {
%1 = tail call i64 @mount_fs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %54
3: ; preds = %0
%4 = tail call i64 @fs_create(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %54
6: ; preds = %3
%7 = tail call i64 @fs_create(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %54
9: ; preds = %6
%10 = tail call i64 @fs_create(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %54
12: ; preds = %9
%13 = tail call i32 @fs_open(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i32 %13, -1
br i1 %14, label %54, label %15
15: ; preds = %12
%16 = tail call i32 @fs_open(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i32 %16, -1
br i1 %17, label %54, label %18
18: ; preds = %15
%19 = tail call i64 @write_test_pattern(i32 %16, i64 12330)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %54
21: ; preds = %18
%22 = tail call i64 @fs_delete(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %54
24: ; preds = %21
%25 = tail call i64 @fs_close(i32 %16)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %54
27: ; preds = %24
%28 = tail call i64 @fs_close(i32 %13)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %54
30: ; preds = %27
%31 = tail call i64 @umount_fs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %54
33: ; preds = %30
%34 = tail call i64 @mount_fs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %54
36: ; preds = %33
%37 = tail call i32 @fs_open(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%38 = icmp eq i32 %37, -1
br i1 %38, label %54, label %39
39: ; preds = %36
%40 = tail call i64 @check_test_pattern(i32 %37, i64 12330)
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %54
42: ; preds = %39
%43 = tail call i64 @fs_close(i32 %37)
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %54
45: ; preds = %42
%46 = tail call i64 @fs_delete(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %54
48: ; preds = %45
%49 = tail call i64 @fs_delete(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%50 = icmp eq i64 %49, 0
br i1 %50, label %51, label %54
51: ; preds = %48
%52 = tail call i64 @umount_fs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%53 = icmp eq i64 %52, 0
br i1 %53, label %58, label %54
54: ; preds = %51, %45, %48, %42, %39, %36, %33, %30, %24, %27, %21, %18, %12, %15, %3, %6, %9, %0
%55 = phi i8* [ getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), %0 ], [ getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), %9 ], [ getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), %6 ], [ getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), %3 ], [ getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0), %15 ], [ getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0), %12 ], [ getelementptr inbounds ([48 x i8], [48 x i8]* @.str.7, i64 0, i64 0), %18 ], [ getelementptr inbounds ([48 x i8], [48 x i8]* @.str.8, i64 0, i64 0), %21 ], [ getelementptr inbounds ([46 x i8], [46 x i8]* @.str.9, i64 0, i64 0), %27 ], [ getelementptr inbounds ([46 x i8], [46 x i8]* @.str.9, i64 0, i64 0), %24 ], [ getelementptr inbounds ([34 x i8], [34 x i8]* @.str.10, i64 0, i64 0), %30 ], [ getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), %33 ], [ getelementptr inbounds ([42 x i8], [42 x i8]* @.str.11, i64 0, i64 0), %36 ], [ getelementptr inbounds ([45 x i8], [45 x i8]* @.str.12, i64 0, i64 0), %39 ], [ getelementptr inbounds ([45 x i8], [45 x i8]* @.str.13, i64 0, i64 0), %42 ], [ getelementptr inbounds ([42 x i8], [42 x i8]* @.str.14, i64 0, i64 0), %48 ], [ getelementptr inbounds ([42 x i8], [42 x i8]* @.str.14, i64 0, i64 0), %45 ], [ getelementptr inbounds ([34 x i8], [34 x i8]* @.str.10, i64 0, i64 0), %51 ]
%56 = load i32, i32* @stderr
%57 = tail call i32 @fprintf(i32 %56, i8* %55)
br label %58
58: ; preds = %54, %51
%59 = phi i32 [ 0, %51 ], [ -1, %54 ]
ret i32 %59
}