#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 *, int);
int /*<<< orphan*/ fread(unsigned char *, int, int, int /*<<< orphan*/);
int getchar();
unsigned char *malloc(int);
int mkdevs(unsigned char *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int mkdevs_main(int argc, char **argv) {
  int l;
  unsigned char *d;
  l = getchar();
  l = l << 8 | getchar();
  d = malloc(l);
  fread(d, l, 1, stdin);
  fprintf(stderr, "%d inodes created\n", mkdevs(d, 1));
  return 0;
}


x86 assembly (clang, -O0):
<mkdevs_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x28(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
or     %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    0x2e4b(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%edx
call   1030 <fread@plt>
mov    0x2e28(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x1,%esi
call   1070 <mkdevs@plt>
mov    -0x24(%rbp),%edi
mov    %eax,%edx
lea    0xe31(%rip),%rsi
call   1050 <fprintf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkdevs_main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
shl    $0x8,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
or     %eax,%ebx
mov    %ebx,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
mov    0x2e6e(%rip),%rax
mov    (%rax),%ecx
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
mov    0x2e46(%rip),%rax
mov    (%rax),%ebx
mov    %r14,%rdi
mov    $0x1,%esi
call   1070 <mkdevs@plt>
lea    0xe58(%rip),%rsi
mov    %ebx,%edi
mov    %eax,%edx
call   1050 <fprintf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stdin = global i32 0
@stderr = global i32 0
@.str = [19 x i8] c"%d inodes created\0A\00"
define i32 @mkdevs_main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = call i32 (...) @getchar()
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = shl i32 %8, 8
%10 = call i32 (...) @getchar()
%11 = or i32 %9, %10
store i32 %11, i32* %5
%12 = load i32, i32* %5
%13 = call i8* @malloc(i32 %12)
store i8* %13, i8** %6
%14 = load i8*, i8** %6
%15 = load i32, i32* %5
%16 = load i32, i32* @stdin
%17 = call i32 @fread(i8* %14, i32 %15, i32 1, i32 %16)
%18 = load i32, i32* @stderr
%19 = load i8*, i8** %6
%20 = call i32 @mkdevs(i8* %19, i32 1)
%21 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %20)
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@stderr = global i32 0
@.str = [19 x i8] c"%d inodes created\0A\00"
define i32 @mkdevs_main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @getchar()
%4 = shl i32 %3, 8
%5 = tail call i32 (...) @getchar()
%6 = or i32 %4, %5
%7 = tail call i8* @malloc(i32 %6)
%8 = load i32, i32* @stdin
%9 = tail call i32 @fread(i8* %7, i32 %6, i32 1, i32 %8)
%10 = load i32, i32* @stderr
%11 = tail call i32 @mkdevs(i8* %7, i32 1)
%12 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %11)
ret i32 0
}