#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 */
struct disk_image {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ create_disk_image(char *, int);
int /*<<< orphan*/ create_log_file(struct disk_image *);
int /*<<< orphan*/ create_new_filesystem(struct disk_image *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
struct disk_image *mount_disk_image(char *);
int /*<<< orphan*/ unmount_disk_image(struct disk_image *);
int /*<<< orphan*/ usage();
int main(int argc, char **argv) {
  struct disk_image *di;
  if (argc != 2) {
    usage();
  }
  create_disk_image(argv[1], 1024 * 512);
  di = mount_disk_image(argv[1]);
  create_new_filesystem(di);
  create_log_file(di);
  unmount_disk_image(di);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1197 <main+0x27>
mov    $0x0,%al
call   1060 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    $0x80000,%esi
call   1040 <create_disk_image@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <mount_disk_image@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <create_new_filesystem@plt>
mov    -0x18(%rbp),%rdi
call   1090 <create_log_file@plt>
mov    -0x18(%rbp),%rdi
call   1050 <unmount_disk_image@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x2,%edi
je     1180 <main+0x10>
xor    %eax,%eax
call   1060 <usage@plt>
mov    0x8(%rbx),%rdi
mov    $0x80000,%esi
call   1040 <create_disk_image@plt>
mov    0x8(%rbx),%rdi
call   1080 <mount_disk_image@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <create_new_filesystem@plt>
mov    %rbx,%rdi
call   1090 <create_log_file@plt>
mov    %rbx,%rdi
call   1050 <unmount_disk_image@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
%struct.disk_image = type { i32 }
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.disk_image*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 (...) @usage()
br label %11
11: ; preds = %9, %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @create_disk_image(i8* %14, i32 524288)
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call %struct.disk_image* @mount_disk_image(i8* %18)
store %struct.disk_image* %19, %struct.disk_image** %6
%20 = load %struct.disk_image*, %struct.disk_image** %6
%21 = call i32 @create_new_filesystem(%struct.disk_image* %20)
%22 = load %struct.disk_image*, %struct.disk_image** %6
%23 = call i32 @create_log_file(%struct.disk_image* %22)
%24 = load %struct.disk_image*, %struct.disk_image** %6
%25 = call i32 @unmount_disk_image(%struct.disk_image* %24)
%26 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.disk_image = type { i32 }
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 (...) @usage()
br label %6
6: ; preds = %4, %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @create_disk_image(i8* %8, i32 524288)
%10 = load i8*, i8** %7
%11 = tail call %struct.disk_image* @mount_disk_image(i8* %10)
%12 = tail call i32 @create_new_filesystem(%struct.disk_image* %11)
%13 = tail call i32 @create_log_file(%struct.disk_image* %11)
%14 = tail call i32 @unmount_disk_image(%struct.disk_image* %11)
%15 = tail call i32 @exit(i32 0)
unreachable
}