#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 stat {
  int dummy;
};
struct dirent {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int stat(char *, struct stat *);
int main(void) {
  char *file1name = "asldfkaslfdkjasl";
  char *file2name = "testval";
  struct dirent *file1, *file2;
  struct stat status_buffer;
  int i = stat(file1name, &status_buffer);
  int j = stat(file2name, &status_buffer);
  printf("i = %d    j = %d\n", i, j);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xed7(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1040 <stat@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1040 <stat@plt>
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%esi
mov    -0x30(%rbp),%edx
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xed6(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1040 <stat@plt>
mov    %eax,%ebp
lea    0xed3(%rip),%rdi
mov    %rbx,%rsi
call   1040 <stat@plt>
lea    0xecc(%rip),%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.dirent = type { i32 }
%struct.stat = type { i32 }
@.str = [17 x i8] c"asldfkaslfdkjasl\00"
@.str.1 = [8 x i8] c"testval\00"
@.str.2 = [18 x i8] c"i = %d j = %d\0A\00"
define i32 @main() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca %struct.dirent*
%4 = alloca %struct.dirent*
%5 = alloca %struct.stat
%6 = alloca i32
%7 = alloca i32
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8** %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %2
%8 = load i8*, i8** %1
%9 = call i32 @stat(i8* %8, %struct.stat* %5)
store i32 %9, i32* %6
%10 = load i8*, i8** %2
%11 = call i32 @stat(i8* %10, %struct.stat* %5)
store i32 %11, i32* %7
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %12, i32 %13)
ret i32 0
}

LLVM IR (-O2):
%struct.stat = type { i32 }
%struct.dirent = type { i32 }
@.str = [17 x i8] c"asldfkaslfdkjasl\00"
@.str.1 = [8 x i8] c"testval\00"
@.str.2 = [18 x i8] c"i = %d j = %d\0A\00"
define i32 @main() {
%1 = alloca %struct.stat
%2 = bitcast %struct.stat* %1 to i8*
%3 = call i32 @stat(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), %struct.stat* %1)
%4 = call i32 @stat(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), %struct.stat* %1)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %3, i32 %4)
ret i32 0
}