#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*/ MFS_Init(char *, int /*<<< orphan*/);
int MFS_Lookup(int /*<<< orphan*/, char *);
int /*<<< orphan*/ MFS_Read(int, char *, int /*<<< orphan*/);
int /*<<< orphan*/ MFS_Shutdown();
int /*<<< orphan*/ atoi(char *);
char *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  MFS_Init("localhost", atoi(argv[1]));
  int inum = MFS_Lookup(0, "test");
  printf("iNum %d\n", inum);
  char *buffer = malloc(4096);
  MFS_Read(inum, buffer, 0);
  printf("BUFFER %s\n", buffer);
  MFS_Shutdown();
  return 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)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,%esi
lea    0xe64(%rip),%rdi
call   1090 <MFS_Init@plt>
xor    %edi,%edi
lea    0xe60(%rip),%rsi
call   1080 <MFS_Lookup@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1000,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
xor    %edx,%edx
call   1060 <MFS_Read@plt>
mov    -0x20(%rbp),%rsi
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <MFS_Shutdown@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    0x8(%rsi),%rdi
call   1070 <atoi@plt>
lea    0xe7d(%rip),%rdi
mov    %eax,%esi
call   1090 <MFS_Init@plt>
lea    0xe79(%rip),%rsi
xor    %edi,%edi
call   1080 <MFS_Lookup@plt>
mov    %eax,%ebp
lea    0xe6e(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1000,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %ebp,%edi
mov    %rax,%rsi
xor    %edx,%edx
call   1060 <MFS_Read@plt>
lea    0xe4e(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <MFS_Shutdown@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"localhost\00"
@.str.1 = [5 x i8] c"test\00"
@.str.2 = [9 x i8] c"iNum %d\0A\00"
@.str.3 = [11 x i8] c"BUFFER %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @atoi(i8* %10)
%12 = call i32 @MFS_Init(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = call i32 @MFS_Lookup(i32 0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
store i32 %13, i32* %6
%14 = load i32, i32* %6
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %14)
%16 = call i8* @malloc(i32 4096)
store i8* %16, i8** %7
%17 = load i32, i32* %6
%18 = load i8*, i8** %7
%19 = call i32 @MFS_Read(i32 %17, i8* %18, i32 0)
%20 = load i8*, i8** %7
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %20)
%22 = call i32 (...) @MFS_Shutdown()
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"localhost\00"
@.str.1 = [5 x i8] c"test\00"
@.str.2 = [9 x i8] c"iNum %d\0A\00"
@.str.3 = [11 x i8] c"BUFFER %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @atoi(i8* %4)
%6 = tail call i32 @MFS_Init(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = tail call i32 @MFS_Lookup(i32 0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = tail call dereferenceable_or_null(4096) i8* @malloc(i32 4096)
%10 = tail call i32 @MFS_Read(i32 %7, i8* %9, i32 0)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %9)
%12 = tail call i32 (...) @MFS_Shutdown()
ret i32 0
}