#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 minix_fs_dat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ close_fs(struct minix_fs_dat *);
struct minix_fs_dat *new_fs(char *, int, int, int);
int /*<<< orphan*/ parse_mkfs(int, char **, int *, int *, int *);
void cmd_mkfs(int argc, char **argv) {
  int req_inos;
  int req_blks;
  int magic;
  char *filename = argv[0];
  struct minix_fs_dat *fs;
  parse_mkfs(argc, argv, &magic, &req_blks, &req_inos);
  fs = new_fs(filename, magic, req_blks, req_inos);
  close_fs(fs);
}


x86 assembly (clang, -O0):
<cmd_mkfs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
lea    -0x18(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1030 <parse_mkfs@plt>
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1050 <new_fs@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
call   1040 <close_fs@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_mkfs>:
push   %rbx
sub    $0x10,%rsp
mov    (%rsi),%rbx
lea    0x4(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0xc(%rsp),%r8
call   1030 <parse_mkfs@plt>
mov    0x4(%rsp),%esi
mov    0x8(%rsp),%edx
mov    0xc(%rsp),%ecx
mov    %rbx,%rdi
call   1050 <new_fs@plt>
mov    %rax,%rdi
call   1040 <close_fs@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.minix_fs_dat = type { i32 }
define void @cmd_mkfs(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca %struct.minix_fs_dat*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%10 = load i8**, i8*** %4
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
store i8* %12, i8** %8
%13 = load i32, i32* %3
%14 = load i8**, i8*** %4
%15 = call i32 @parse_mkfs(i32 %13, i8** %14, i32* %7, i32* %6, i32* %5)
%16 = load i8*, i8** %8
%17 = load i32, i32* %7
%18 = load i32, i32* %6
%19 = load i32, i32* %5
%20 = call %struct.minix_fs_dat* @new_fs(i8* %16, i32 %17, i32 %18, i32 %19)
store %struct.minix_fs_dat* %20, %struct.minix_fs_dat** %9
%21 = load %struct.minix_fs_dat*, %struct.minix_fs_dat** %9
%22 = call i32 @close_fs(%struct.minix_fs_dat* %21)
ret void
}

LLVM IR (-O2):
%struct.minix_fs_dat = type { i32 }
define void @cmd_mkfs(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = bitcast i32* %5 to i8*
%9 = load i8*, i8** %1
%10 = call i32 @parse_mkfs(i32 %0, i8** %1, i32* %5, i32* %4, i32* %3)
%11 = load i32, i32* %5
%12 = load i32, i32* %4
%13 = load i32, i32* %3
%14 = call %struct.minix_fs_dat* @new_fs(i8* %9, i32 %11, i32 %12, i32 %13)
%15 = call i32 @close_fs(%struct.minix_fs_dat* %14)
ret void
}