#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 {
  unsigned long st_nlink;
  scalar_t__ st_dev;
  scalar_t__ st_ino;
  scalar_t__ st_size;
};

/* Variables and functions */
int /*<<< orphan*/ err(int, char *, char *);
int /*<<< orphan*/ errx(int, char *);
int stat(char *, struct stat *);
int main(int argc, char *argv[]) {
  struct stat st1;
  struct stat st2;
  struct stat *sta = &st1;
  struct stat *stb = &st2;
  if (argc < 3)
    errx(2, "too few arguments");
  if (stat(argv[1], &st1) == -1)
    err(3, "cannot stat %s", argv[1]);
  if (sta->st_nlink != (unsigned long)argc - 1)
    return 1;
  for (int i = 2; i < argc - 1; i++) {
    if (stat(argv[i], stb) == -1)
      err(3, "cannot stat %s", argv[i + 1]);
    if (stb->st_nlink != (unsigned long)argc - 1 ||
        sta->st_dev != stb->st_dev || sta->st_ino != stb->st_ino ||
        sta->st_size != stb->st_size)
      return 1;
    sta = stb;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x58(%rbp)
lea    -0x50(%rbp),%rax
mov    %rax,-0x60(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1171 <main+0x41>
mov    $0x2,%edi
lea    0xe94(%rip),%rsi
call   1030 <errx@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x30(%rbp),%rsi
call   1040 <stat@plt>
cmp    $0xffffffff,%eax
jne    11a4 <main+0x74>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    $0x3,%edi
lea    0xe73(%rip),%rsi
call   1050 <err@plt>
mov    -0x58(%rbp),%rax
mov    (%rax),%rax
movslq -0x8(%rbp),%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
je     11c8 <main+0x98>
movl   $0x1,-0x4(%rbp)
jmp    12a3 <main+0x173>
movl   $0x2,-0x64(%rbp)
mov    -0x64(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    129c <main+0x16c>
mov    -0x10(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x60(%rbp),%rsi
call   1040 <stat@plt>
cmp    $0xffffffff,%eax
jne    1220 <main+0xf0>
mov    -0x10(%rbp),%rax
mov    -0x64(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
mov    $0x3,%edi
lea    0xdf7(%rip),%rsi
call   1050 <err@plt>
mov    -0x60(%rbp),%rax
mov    (%rax),%rax
movslq -0x8(%rbp),%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
jne    127a <main+0x14a>
mov    -0x58(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0x60(%rbp),%rcx
cmp    0x8(%rcx),%rax
jne    127a <main+0x14a>
mov    -0x58(%rbp),%rax
mov    0x10(%rax),%rax
mov    -0x60(%rbp),%rcx
cmp    0x10(%rcx),%rax
jne    127a <main+0x14a>
mov    -0x58(%rbp),%rax
mov    0x18(%rax),%rax
mov    -0x60(%rbp),%rcx
cmp    0x18(%rcx),%rax
je     1286 <main+0x156>
movl   $0x1,-0x4(%rbp)
jmp    12a3 <main+0x173>
mov    -0x60(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    11cf <main+0x9f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rsi,%r14
mov    %edi,%r15d
cmp    $0x2,%edi
jg     115a <main+0x2a>
lea    0xeb0(%rip),%rsi
mov    $0x2,%edi
call   1030 <errx@plt>
mov    0x8(%r14),%rdi
lea    0x28(%rsp),%rbx
mov    %rbx,%rsi
call   1040 <stat@plt>
cmp    $0xffffffff,%eax
jne    1185 <main+0x55>
mov    0x8(%r14),%rdx
lea    0xe97(%rip),%rsi
mov    $0x3,%edi
call   1050 <err@plt>
mov    0x28(%rsp),%rbp
movslq %r15d,%rax
add    $0xffffffffffffffff,%rax
cmp    %rax,%rbp
jne    1210 <main+0xe0>
xor    %eax,%eax
cmp    $0x4,%r15d
jl     1215 <main+0xe5>
add    $0xffffffff,%r15d
add    $0xfffffffffffffffe,%r15
xor    %r13d,%r13d
lea    0x8(%rsp),%r12
xchg   %ax,%ax
mov    0x10(%r14,%r13,8),%rdi
mov    %r12,%rsi
call   1040 <stat@plt>
cmp    $0xffffffff,%eax
jne    11d8 <main+0xa8>
mov    0x18(%r14,%r13,8),%rdx
mov    $0x3,%edi
lea    0xe3f(%rip),%rsi
call   1050 <err@plt>
cmp    %rbp,0x8(%rsp)
jne    1210 <main+0xe0>
mov    0x8(%rbx),%rax
cmp    0x10(%rsp),%rax
jne    1210 <main+0xe0>
mov    0x10(%rbx),%rax
cmp    0x18(%rsp),%rax
jne    1210 <main+0xe0>
mov    0x18(%rbx),%rax
cmp    0x20(%rsp),%rax
jne    1210 <main+0xe0>
add    $0x1,%r13
mov    %r12,%rbx
cmp    %r13,%r15
jne    11b0 <main+0x80>
xor    %eax,%eax
jmp    1215 <main+0xe5>
mov    $0x1,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i64, i64, i64, i64 }
@.str = [18 x i8] c"too few arguments\00"
@.str.1 = [15 x i8] c"cannot stat %s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.stat
%7 = alloca %struct.stat
%8 = alloca %struct.stat*
%9 = alloca %struct.stat*
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store %struct.stat* %6, %struct.stat** %8
store %struct.stat* %7, %struct.stat** %9
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 3
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 @errx(i32 2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %13, %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @stat(i8* %18, %struct.stat* %6)
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %26
21: ; preds = %15
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i32 @err(i32 3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %24)
br label %26
26: ; preds = %21, %15
%27 = load %struct.stat*, %struct.stat** %8
%28 = getelementptr inbounds %struct.stat, %struct.stat* %27, i32 0, i32 0
%29 = load i64, i64* %28
%30 = load i32, i32* %4
%31 = sext i32 %30 to i64
%32 = sub i64 %31, 1
%33 = icmp ne i64 %29, %32
br i1 %33, label %34, label %35
34: ; preds = %26
store i32 1, i32* %3
br label %97
35: ; preds = %26
store i32 2, i32* %10
br label %36
36: ; preds = %93, %35
%37 = load i32, i32* %10
%38 = load i32, i32* %4
%39 = sub nsw i32 %38, 1
%40 = icmp slt i32 %37, %39
br i1 %40, label %41, label %96
41: ; preds = %36
%42 = load i8**, i8*** %5
%43 = load i32, i32* %10
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8*, i8** %42, i64 %44
%46 = load i8*, i8** %45
%47 = load %struct.stat*, %struct.stat** %9
%48 = call i32 @stat(i8* %46, %struct.stat* %47)
%49 = icmp eq i32 %48, -1
br i1 %49, label %50, label %58
50: ; preds = %41
%51 = load i8**, i8*** %5
%52 = load i32, i32* %10
%53 = add nsw i32 %52, 1
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8*, i8** %51, i64 %54
%56 = load i8*, i8** %55
%57 = call i32 @err(i32 3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %56)
br label %58
58: ; preds = %50, %41
%59 = load %struct.stat*, %struct.stat** %9
%60 = getelementptr inbounds %struct.stat, %struct.stat* %59, i32 0, i32 0
%61 = load i64, i64* %60
%62 = load i32, i32* %4
%63 = sext i32 %62 to i64
%64 = sub i64 %63, 1
%65 = icmp ne i64 %61, %64
br i1 %65, label %90, label %66
66: ; preds = %58
%67 = load %struct.stat*, %struct.stat** %8
%68 = getelementptr inbounds %struct.stat, %struct.stat* %67, i32 0, i32 1
%69 = load i64, i64* %68
%70 = load %struct.stat*, %struct.stat** %9
%71 = getelementptr inbounds %struct.stat, %struct.stat* %70, i32 0, i32 1
%72 = load i64, i64* %71
%73 = icmp ne i64 %69, %72
br i1 %73, label %90, label %74
74: ; preds = %66
%75 = load %struct.stat*, %struct.stat** %8
%76 = getelementptr inbounds %struct.stat, %struct.stat* %75, i32 0, i32 2
%77 = load i64, i64* %76
%78 = load %struct.stat*, %struct.stat** %9
%79 = getelementptr inbounds %struct.stat, %struct.stat* %78, i32 0, i32 2
%80 = load i64, i64* %79
%81 = icmp ne i64 %77, %80
br i1 %81, label %90, label %82
82: ; preds = %74
%83 = load %struct.stat*, %struct.stat** %8
%84 = getelementptr inbounds %struct.stat, %struct.stat* %83, i32 0, i32 3
%85 = load i64, i64* %84
%86 = load %struct.stat*, %struct.stat** %9
%87 = getelementptr inbounds %struct.stat, %struct.stat* %86, i32 0, i32 3
%88 = load i64, i64* %87
%89 = icmp ne i64 %85, %88
br i1 %89, label %90, label %91
90: ; preds = %82, %74, %66, %58
store i32 1, i32* %3
br label %97
91: ; preds = %82
%92 = load %struct.stat*, %struct.stat** %9
store %struct.stat* %92, %struct.stat** %8
br label %93
93: ; preds = %91
%94 = load i32, i32* %10
%95 = add nsw i32 %94, 1
store i32 %95, i32* %10
br label %36
96: ; preds = %36
store i32 0, i32* %3
br label %97
97: ; preds = %96, %90, %34
%98 = load i32, i32* %3
ret i32 %98
}

LLVM IR (-O2):
%struct.stat = type { i64, i64, i64, i64 }
@.str = [18 x i8] c"too few arguments\00"
@.str.1 = [15 x i8] c"cannot stat %s\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.stat
%4 = alloca %struct.stat
%5 = bitcast %struct.stat* %3 to i8*
%6 = bitcast %struct.stat* %4 to i8*
%7 = icmp slt i32 %0, 3
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 @errx(i32 2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @stat(i8* %12, %struct.stat* %3)
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %18
15: ; preds = %10
%16 = load i8*, i8** %11
%17 = tail call i32 @err(i32 3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %16)
br label %18
18: ; preds = %15, %10
%19 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%20 = load i64, i64* %19
%21 = sext i32 %0 to i64
%22 = add nsw i64 %21, -1
%23 = icmp eq i64 %20, %22
br i1 %23, label %24, label %66
24: ; preds = %18
%25 = icmp sgt i32 %0, 3
br i1 %25, label %26, label %66
26: ; preds = %24
%27 = add nsw i32 %0, -1
%28 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 0
%29 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 1
%30 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 2
%31 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 3
%32 = zext i32 %27 to i64
br label %35
33: ; preds = %60
%34 = icmp eq i64 %65, %32
br i1 %34, label %66, label %35
35: ; preds = %26, %33
%36 = phi i64 [ 2, %26 ], [ %65, %33 ]
%37 = phi %struct.stat* [ %3, %26 ], [ %4, %33 ]
%38 = getelementptr inbounds i8*, i8** %1, i64 %36
%39 = load i8*, i8** %38
%40 = call i32 @stat(i8* %39, %struct.stat* %4)
%41 = icmp eq i32 %40, -1
br i1 %41, label %42, label %47
42: ; preds = %35
%43 = add nuw nsw i64 %36, 1
%44 = getelementptr inbounds i8*, i8** %1, i64 %43
%45 = load i8*, i8** %44
%46 = tail call i32 @err(i32 3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %45)
br label %47
47: ; preds = %42, %35
%48 = load i64, i64* %28
%49 = icmp eq i64 %48, %20
br i1 %49, label %50, label %66
50: ; preds = %47
%51 = getelementptr inbounds %struct.stat, %struct.stat* %37, i64 0, i32 1
%52 = load i64, i64* %51
%53 = load i64, i64* %29
%54 = icmp eq i64 %52, %53
br i1 %54, label %55, label %66
55: ; preds = %50
%56 = getelementptr inbounds %struct.stat, %struct.stat* %37, i64 0, i32 2
%57 = load i64, i64* %56
%58 = load i64, i64* %30
%59 = icmp eq i64 %57, %58
br i1 %59, label %60, label %66
60: ; preds = %55
%61 = getelementptr inbounds %struct.stat, %struct.stat* %37, i64 0, i32 3
%62 = load i64, i64* %61
%63 = load i64, i64* %31
%64 = icmp eq i64 %62, %63
%65 = add nuw nsw i64 %36, 1
br i1 %64, label %33, label %66
66: ; preds = %47, %50, %55, %60, %33, %24, %18
%67 = phi i32 [ 1, %18 ], [ 0, %24 ], [ 1, %47 ], [ 1, %50 ], [ 1, %55 ], [ 1, %60 ], [ 0, %33 ]
ret i32 %67
}