#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 {
  scalar_t__ st_mtime;
};

/* Variables and functions */
int PATH_MAX;
int /*<<< orphan*/ sprintf(char *, char *);
scalar_t__ stat(char *, struct stat *);
int has_gemfile_mismatch() {
  char pathname[PATH_MAX];
  struct stat lockfile, gemfile;
  sprintf(pathname, "./Gemfile");
  if (stat(pathname, &gemfile) < 0)
    return 0;
  sprintf(pathname, "./Gemfile.lock");
  if (stat(pathname, &lockfile) < 0)
    return 0;
  if (lockfile.st_mtime < gemfile.st_mtime)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<has_gemfile_mismatch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x2ec1(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x38(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x18(%rbp)
lea    0xea5(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x38(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
jge    118a <has_gemfile_mismatch+0x6a>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x2c(%rbp)
jmp    11f3 <has_gemfile_mismatch+0xd3>
mov    -0x38(%rbp),%rdi
lea    0xe75(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x38(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
jge    11c4 <has_gemfile_mismatch+0xa4>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x2c(%rbp)
jmp    11f3 <has_gemfile_mismatch+0xd3>
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jge    11e5 <has_gemfile_mismatch+0xc5>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x2c(%rbp)
jmp    11f3 <has_gemfile_mismatch+0xd3>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<has_gemfile_mismatch>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    0x2ecc(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
mov    %rcx,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
neg    %rax
movabs $0x6c69666d65472f2e,%r15
66 69 6c
mov    %r15,(%rcx,%rax,1)
movw   $0x65,0x8(%rbx)
lea    -0x20(%rbp),%rsi
mov    %rbx,%rdi
call   1030 <stat@plt>
xor    %r14d,%r14d
test   %rax,%rax
js     1196 <has_gemfile_mismatch+0x86>
movabs $0x6b636f6c2e656c,%rax
mov    %rax,0x7(%rbx)
mov    %r15,(%rbx)
lea    -0x28(%rbp),%rsi
mov    %rbx,%rdi
call   1030 <stat@plt>
test   %rax,%rax
js     1196 <has_gemfile_mismatch+0x86>
mov    -0x28(%rbp),%rax
xor    %r14d,%r14d
cmp    -0x20(%rbp),%rax
setl   %r14b
mov    %r14d,%eax
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i64 }
@PATH_MAX = global i32 0
@.str = [10 x i8] c"./Gemfile\00"
@.str.1 = [15 x i8] c"./Gemfile.lock\00"
define i32 @has_gemfile_mismatch() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i64
%4 = alloca %struct.stat
%5 = alloca %struct.stat
%6 = alloca i32
%7 = load i32, i32* @PATH_MAX
%8 = zext i32 %7 to i64
%9 = call i8* @llvm.stacksave()
store i8* %9, i8** %2
%10 = alloca i8, i64 %8
store i64 %8, i64* %3
%11 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%12 = call i64 @stat(i8* %10, %struct.stat* %5)
%13 = icmp slt i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %0
store i32 0, i32* %1
store i32 1, i32* %6
br label %28
15: ; preds = %0
%16 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%17 = call i64 @stat(i8* %10, %struct.stat* %4)
%18 = icmp slt i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %15
store i32 0, i32* %1
store i32 1, i32* %6
br label %28
20: ; preds = %15
%21 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%22 = load i64, i64* %21
%23 = getelementptr inbounds %struct.stat, %struct.stat* %5, i32 0, i32 0
%24 = load i64, i64* %23
%25 = icmp slt i64 %22, %24
br i1 %25, label %26, label %27
26: ; preds = %20
store i32 1, i32* %1
store i32 1, i32* %6
br label %28
27: ; preds = %20
store i32 0, i32* %1
store i32 1, i32* %6
br label %28
28: ; preds = %27, %26, %19, %14
%29 = load i8*, i8** %2
%30 = load i32, i32* %1
ret i32 %30
}

LLVM IR (-O2):
%struct.stat = type { i64 }
@PATH_MAX = global i32 0
@.str = [10 x i8] c"./Gemfile\00"
@.str.1 = [15 x i8] c"./Gemfile.lock\00"
define i32 @has_gemfile_mismatch() {
%1 = alloca %struct.stat
%2 = alloca %struct.stat
%3 = load i32, i32* @PATH_MAX
%4 = zext i32 %3 to i64
%5 = alloca i8, i64 %4
%6 = bitcast %struct.stat* %1 to i8*
%7 = bitcast %struct.stat* %2 to i8*
%8 = call i64 @stat(i8* %5, %struct.stat* %2)
%9 = icmp slt i64 %8, 0
br i1 %9, label %20, label %10
10: ; preds = %0
%11 = call i64 @stat(i8* %5, %struct.stat* %1)
%12 = icmp slt i64 %11, 0
br i1 %12, label %20, label %13
13: ; preds = %10
%14 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 0
%15 = load i64, i64* %14
%16 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%17 = load i64, i64* %16
%18 = icmp slt i64 %15, %17
%19 = zext i1 %18 to i32
br label %20
20: ; preds = %13, %10, %0
%21 = phi i32 [ 0, %0 ], [ 0, %10 ], [ %19, %13 ]
ret i32 %21
}