#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 /*<<< orphan*/ st_ctime;
  int /*<<< orphan*/ st_mtime;
  int /*<<< orphan*/ st_size;
  int /*<<< orphan*/ st_gid;
  int /*<<< orphan*/ st_uid;
  int /*<<< orphan*/ st_rdev;
  int /*<<< orphan*/ st_dev;
  int /*<<< orphan*/ st_ino;
};
typedef int /*<<< orphan*/ control;

/* Variables and functions */
int /*<<< orphan*/ key(struct stat *, int);
int /*<<< orphan*/ memset(struct stat *, int /*<<< orphan*/, int);
scalar_t__ stat(char *, struct stat *);
int key_with_file(char *file) {
  struct stat statf[1];
  struct stat control[1];
  if (stat(file, statf) < 0)
    return -1;
  memset(control, 0, sizeof(control));
  control->st_ino = statf->st_ino;
  control->st_dev = statf->st_dev;
  control->st_rdev = statf->st_rdev;
  control->st_uid = statf->st_uid;
  control->st_gid = statf->st_gid;
  control->st_size = statf->st_size;
  control->st_mtime = statf->st_mtime;
  control->st_ctime = statf->st_ctime;
  key(control, sizeof(control));
  return 0;
}


x86 assembly (clang, -O0):
<key_with_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1050 <stat@plt>
cmp    $0x0,%rax
jge    115f <key_with_file+0x2f>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b4 <key_with_file+0x84>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1040 <memset@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x50(%rbp)
lea    -0x50(%rbp),%rdi
mov    $0x20,%esi
call   1030 <key@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<key_with_file>:
push   %r14
push   %rbx
sub    $0x48,%rsp
lea    0x20(%rsp),%rsi
call   1050 <stat@plt>
test   %rax,%rax
js     117c <key_with_file+0x4c>
mov    %rsp,%r14
xor    %ebx,%ebx
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1040 <memset@plt>
movaps 0x20(%rsp),%xmm0
movaps 0x30(%rsp),%xmm1
movaps %xmm1,0x10(%rsp)
movaps %xmm0,(%rsp)
mov    %r14,%rdi
mov    $0x20,%esi
call   1030 <key@plt>
jmp    1181 <key_with_file+0x51>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.stat = type { i32, i32, i32, i32, i32, i32, i32, i32 }
define i32 @key_with_file(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [1 x %struct.stat]
%5 = alloca [1 x %struct.stat]
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = getelementptr inbounds [1 x %struct.stat], [1 x %struct.stat]* %4, i64 0, i64 0
%8 = call i64 @stat(i8* %6, %struct.stat* %7)
%9 = icmp slt i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 -1, i32* %2
br label %56
11: ; preds = %1
%12 = getelementptr inbounds [1 x %struct.stat], [1 x %struct.stat]* %5, i64 0, i64 0
%13 = call i32 @memset(%struct.stat* %12, i32 0, i32 32)
%14 = getelementptr inbounds [1 x %struct.stat], [1 x %struct.stat]* %4, i64 0, i64 0
%15 = getelementptr inbounds %struct.stat, %struct.stat* %14, i32 0, i32 7
%16 = load i32, i32* %15
%17 = getelementptr inbounds [1 x %struct.stat], [1 x %struct.stat]* %5, i64 0, i64 0
%18 = getelementptr inbounds %struct.stat, %struct.stat* %17, i32 0, i32 7
store i32 %16, i32* %18
%19 = getelementptr inbounds [1 x %struct.stat], [1 x %struct.stat]* %4, i64 0, i64 0
%20 = getelementptr inbounds %struct.stat, %struct.stat* %19, i32 0, i32 6
%21 = load i32, i32* %20
%22 = getelementptr inbounds [1 x %struct.stat], [1 x %struct.stat]* %5, i64 0, i64 0
%23 = getelementptr inbounds %struct.stat, %struct.stat* %22, i32 0, i32 6
store i32 %21, i32* %23
%24 = getelementptr inbounds [1 x %struct.stat], [1 x %struct.stat]* %4, i64 0, i64 0
%25 = getelementptr inbounds %struct.stat, %struct.stat* %24, i32 0, i32 5
%26 = load i32, i32* %25
%27 = getelementptr inbounds [1 x %struct.stat], [1 x %struct.stat]* %5, i64 0, i64 0
%28 = getelementptr inbounds %struct.stat, %struct.stat* %27, i32 0, i32 5
store i32 %26, i32* %28
%29 = getelementptr inbounds [1 x %struct.stat], [1 x %struct.stat]* %4, i64 0, i64 0
%30 = getelementptr inbounds %struct.stat, %struct.stat* %29, i32 0, i32 4
%31 = load i32, i32* %30
%32 = getelementptr inbounds [1 x %struct.stat], [1 x %struct.stat]* %5, i64 0, i64 0
%33 = getelementptr inbounds %struct.stat, %struct.stat* %32, i32 0, i32 4
store i32 %31, i32* %33
%34 = getelementptr inbounds [1 x %struct.stat], [1 x %struct.stat]* %4, i64 0, i64 0
%35 = getelementptr inbounds %struct.stat, %struct.stat* %34, i32 0, i32 3
%36 = load i32, i32* %35
%37 = getelementptr inbounds [1 x %struct.stat], [1 x %struct.stat]* %5, i64 0, i64 0
%38 = getelementptr inbounds %struct.stat, %struct.stat* %37, i32 0, i32 3
store i32 %36, i32* %38
%39 = getelementptr inbounds [1 x %struct.stat], [1 x %struct.stat]* %4, i64 0, i64 0
%40 = getelementptr inbounds %struct.stat, %struct.stat* %39, i32 0, i32 2
%41 = load i32, i32* %40
%42 = getelementptr inbounds [1 x %struct.stat], [1 x %struct.stat]* %5, i64 0, i64 0
%43 = getelementptr inbounds %struct.stat, %struct.stat* %42, i32 0, i32 2
store i32 %41, i32* %43
%44 = getelementptr inbounds [1 x %struct.stat], [1 x %struct.stat]* %4, i64 0, i64 0
%45 = getelementptr inbounds %struct.stat, %struct.stat* %44, i32 0, i32 1
%46 = load i32, i32* %45
%47 = getelementptr inbounds [1 x %struct.stat], [1 x %struct.stat]* %5, i64 0, i64 0
%48 = getelementptr inbounds %struct.stat, %struct.stat* %47, i32 0, i32 1
store i32 %46, i32* %48
%49 = getelementptr inbounds [1 x %struct.stat], [1 x %struct.stat]* %4, i64 0, i64 0
%50 = getelementptr inbounds %struct.stat, %struct.stat* %49, i32 0, i32 0
%51 = load i32, i32* %50
%52 = getelementptr inbounds [1 x %struct.stat], [1 x %struct.stat]* %5, i64 0, i64 0
%53 = getelementptr inbounds %struct.stat, %struct.stat* %52, i32 0, i32 0
store i32 %51, i32* %53
%54 = getelementptr inbounds [1 x %struct.stat], [1 x %struct.stat]* %5, i64 0, i64 0
%55 = call i32 @key(%struct.stat* %54, i32 32)
store i32 0, i32* %2
br label %56
56: ; preds = %11, %10
%57 = load i32, i32* %2
ret i32 %57
}

LLVM IR (-O2):
%struct.stat = type { i32, i32, i32, i32, i32, i32, i32, i32 }
define i32 @key_with_file(i8* %0) {
%2 = alloca [1 x %struct.stat]
%3 = alloca [1 x %struct.stat]
%4 = bitcast [1 x %struct.stat]* %2 to i8*
%5 = bitcast [1 x %struct.stat]* %3 to i8*
%6 = getelementptr inbounds [1 x %struct.stat], [1 x %struct.stat]* %2, i64 0, i64 0
%7 = call i64 @stat(i8* %0, %struct.stat* %6)
%8 = icmp slt i64 %7, 0
br i1 %8, label %21, label %9
9: ; preds = %1
%10 = getelementptr inbounds [1 x %struct.stat], [1 x %struct.stat]* %3, i64 0, i64 0
%11 = call i32 @memset(%struct.stat* %10, i32 0, i32 32)
%12 = getelementptr inbounds [1 x %struct.stat], [1 x %struct.stat]* %2, i64 0, i64 0, i32 4
%13 = bitcast i32* %12 to <4 x i32>*
%14 = load <4 x i32>, <4 x i32>* %13
%15 = getelementptr inbounds [1 x %struct.stat], [1 x %struct.stat]* %3, i64 0, i64 0, i32 4
%16 = bitcast i32* %15 to <4 x i32>*
store <4 x i32> %14, <4 x i32>* %16
%17 = bitcast [1 x %struct.stat]* %2 to <4 x i32>*
%18 = load <4 x i32>, <4 x i32>* %17
%19 = bitcast [1 x %struct.stat]* %3 to <4 x i32>*
store <4 x i32> %18, <4 x i32>* %19
%20 = call i32 @key(%struct.stat* %10, i32 32)
br label %21
21: ; preds = %1, %9
%22 = phi i32 [ 0, %9 ], [ -1, %1 ]
ret i32 %22
}