#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 EXIT_SUCCESS;
int /*<<< orphan*/ minix_mkfs(char const *, unsigned int, unsigned int);
int /*<<< orphan*/ sscanf(char *, char *, unsigned int *);
int /*<<< orphan*/ usage();
int main(int argc, char **argv) {
  unsigned ninodes;
  unsigned nblocks;
  const char *diskfile;
  if (argc < 4)
    usage();
  diskfile = argv[1];
  sscanf(argv[2], "%u", &ninodes);
  sscanf(argv[3], "%u", &nblocks);
  minix_mkfs(diskfile, ninodes, nblocks);
  return (EXIT_SUCCESS);
}


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   $0x4,-0x8(%rbp)
jge    1157 <main+0x27>
mov    $0x0,%al
call   1040 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe8e(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1030 <sscanf@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xe76(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1030 <sscanf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1050 <minix_mkfs@plt>
mov    0x2e37(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
cmp    $0x3,%edi
jg     1148 <main+0x18>
xor    %eax,%eax
call   1040 <usage@plt>
mov    0x8(%rbx),%r14
mov    0x10(%rbx),%rdi
lea    0xea9(%rip),%r15
lea    0xc(%rsp),%rdx
mov    %r15,%rsi
call   1030 <sscanf@plt>
mov    0x18(%rbx),%rdi
lea    0x8(%rsp),%rdx
mov    %r15,%rsi
call   1030 <sscanf@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %r14,%rdi
call   1050 <minix_mkfs@plt>
mov    0x2e54(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%u\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%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, 4
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 (...) @usage()
br label %13
13: ; preds = %11, %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
store i8* %16, i8** %8
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
%20 = call i32 @sscanf(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 3
%23 = load i8*, i8** %22
%24 = call i32 @sscanf(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
%25 = load i8*, i8** %8
%26 = load i32, i32* %6
%27 = load i32, i32* %7
%28 = call i32 @minix_mkfs(i8* %25, i32 %26, i32 %27)
%29 = load i32, i32* @EXIT_SUCCESS
ret i32 %29
}

LLVM IR (-O2):
@.str = [3 x i8] c"%u\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = icmp slt i32 %0, 4
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 (...) @usage()
br label %10
10: ; preds = %8, %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = call i32 @sscanf(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%16 = getelementptr inbounds i8*, i8** %1, i64 3
%17 = load i8*, i8** %16
%18 = call i32 @sscanf(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = call i32 @minix_mkfs(i8* %12, i32 %19, i32 %20)
%22 = load i32, i32* @EXIT_SUCCESS
ret i32 %22
}