#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_dev;
  scalar_t__ st_ino;
};

/* Variables and functions */
int /*<<< orphan*/ error(char *);
scalar_t__ stat(char const *, struct stat *);
void check_files(const char *infile_name, const char *outfile_name) {
  struct stat infile_info;
  struct stat outfile_info;
  if (stat(infile_name, &infile_info) < 0)
    return;
  if (stat(outfile_name, &outfile_info) < 0)
    return;
  if (infile_info.st_dev == outfile_info.st_dev &&
      infile_info.st_ino == outfile_info.st_ino)
    error("infile and outfile must be different");
}


x86 assembly (clang, -O0):
<check_files>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
jge    114c <check_files+0x2c>
jmp    1190 <check_files+0x70>
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
jge    1168 <check_files+0x48>
jmp    1190 <check_files+0x70>
mov    -0x20(%rbp),%rax
cmp    -0x30(%rbp),%rax
jne    1190 <check_files+0x70>
mov    -0x18(%rbp),%rax
cmp    -0x28(%rbp),%rax
jne    1190 <check_files+0x70>
lea    0xe75(%rip),%rdi
call   1040 <error@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_files>:
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbx
lea    0x10(%rsp),%rsi
call   1030 <stat@plt>
test   %rax,%rax
js     116a <check_files+0x4a>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <stat@plt>
test   %rax,%rax
js     116a <check_files+0x4a>
mov    0x10(%rsp),%rax
cmp    (%rsp),%rax
jne    116a <check_files+0x4a>
mov    0x18(%rsp),%rax
cmp    0x8(%rsp),%rax
jne    116a <check_files+0x4a>
lea    0xe9b(%rip),%rdi
call   1040 <error@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.stat = type { i64, i64 }
@.str = [37 x i8] c"infile and outfile must be different\00"
define void @check_files(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca %struct.stat
%6 = alloca %struct.stat
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = call i64 @stat(i8* %7, %struct.stat* %5)
%9 = icmp slt i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %2
br label %30
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = call i64 @stat(i8* %12, %struct.stat* %6)
%14 = icmp slt i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %11
br label %30
16: ; preds = %11
%17 = getelementptr inbounds %struct.stat, %struct.stat* %5, i32 0, i32 0
%18 = load i64, i64* %17
%19 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%20 = load i64, i64* %19
%21 = icmp eq i64 %18, %20
br i1 %21, label %22, label %30
22: ; preds = %16
%23 = getelementptr inbounds %struct.stat, %struct.stat* %5, i32 0, i32 1
%24 = load i64, i64* %23
%25 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 1
%26 = load i64, i64* %25
%27 = icmp eq i64 %24, %26
br i1 %27, label %28, label %30
28: ; preds = %22
%29 = call i32 @error(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
br label %30
30: ; preds = %10, %15, %28, %22, %16
ret void
}

LLVM IR (-O2):
%struct.stat = type { i64, i64 }
@.str = [37 x i8] c"infile and outfile must be different\00"
define void @check_files(i8* %0, i8* %1) {
%3 = alloca %struct.stat
%4 = alloca %struct.stat
%5 = bitcast %struct.stat* %3 to i8*
%6 = bitcast %struct.stat* %4 to i8*
%7 = call i64 @stat(i8* %0, %struct.stat* %3)
%8 = icmp slt i64 %7, 0
br i1 %8, label %26, label %9
9: ; preds = %2
%10 = call i64 @stat(i8* %1, %struct.stat* %4)
%11 = icmp slt i64 %10, 0
br i1 %11, label %26, label %12
12: ; preds = %9
%13 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%14 = load i64, i64* %13
%15 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 0
%16 = load i64, i64* %15
%17 = icmp eq i64 %14, %16
br i1 %17, label %18, label %26
18: ; preds = %12
%19 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 1
%20 = load i64, i64* %19
%21 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 1
%22 = load i64, i64* %21
%23 = icmp eq i64 %20, %22
br i1 %23, label %24, label %26
24: ; preds = %18
%25 = call i32 @error(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
br label %26
26: ; preds = %12, %18, %24, %9, %2
ret void
}