#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;
};

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ show_stat_info(char *, struct stat *);
int stat(char *, struct stat *);
int main(int argc, char *argv[]) {
  struct stat stat_buf;
  while (--argc > 0) {
    if (stat(*++argv, &stat_buf) == -1) {
      perror(*argv);
      return EXIT_FAILURE;
    }
    show_stat_info(*argv, &stat_buf);
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    11af <main+0x7f>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0xffffffff,%eax
jne    119a <main+0x6a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <perror@plt>
mov    0x2e50(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11bb <main+0x8b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <show_stat_info@plt>
jmp    1146 <main+0x16>
mov    0x2e22(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    0x2e9a(%rip),%r15
cmp    $0x2,%edi
jl     1187 <main+0x57>
mov    %rsi,%rbx
mov    %edi,%ebp
add    $0x1,%ebp
add    $0x8,%rbx
mov    %rsp,%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%rbx),%rdi
mov    %r14,%rsi
call   1030 <stat@plt>
cmp    $0xffffffff,%eax
je     1195 <main+0x65>
mov    (%rbx),%rdi
mov    %r14,%rsi
call   1040 <show_stat_info@plt>
add    $0xffffffff,%ebp
add    $0x8,%rbx
cmp    $0x2,%ebp
jg     1160 <main+0x30>
mov    (%r15),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%rbx),%rdi
call   1050 <perror@plt>
mov    0x2e3c(%rip),%r15
jmp    1187 <main+0x57>

LLVM IR (-O0):
%struct.stat = type { i32 }
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.stat
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %7
7: ; preds = %22, %2
%8 = load i32, i32* %4
%9 = add nsw i32 %8, -1
store i32 %9, i32* %4
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %26
11: ; preds = %7
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i32 1
store i8** %13, i8*** %5
%14 = load i8*, i8** %13
%15 = call i32 @stat(i8* %14, %struct.stat* %6)
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %22
17: ; preds = %11
%18 = load i8**, i8*** %5
%19 = load i8*, i8** %18
%20 = call i32 @perror(i8* %19)
%21 = load i32, i32* @EXIT_FAILURE
store i32 %21, i32* %3
br label %28
22: ; preds = %11
%23 = load i8**, i8*** %5
%24 = load i8*, i8** %23
%25 = call i32 @show_stat_info(i8* %24, %struct.stat* %6)
br label %7
26: ; preds = %7
%27 = load i32, i32* @EXIT_SUCCESS
store i32 %27, i32* %3
br label %28
28: ; preds = %26, %17
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.stat
%4 = bitcast %struct.stat* %3 to i8*
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %21
6: ; preds = %2, %16
%7 = phi i32 [ %17, %16 ], [ %0, %2 ]
%8 = phi i8** [ %9, %16 ], [ %1, %2 ]
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @stat(i8* %10, %struct.stat* %3)
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %16
13: ; preds = %6
%14 = load i8*, i8** %9
%15 = call i32 @perror(i8* %14)
br label %21
16: ; preds = %6
%17 = add nsw i32 %7, -1
%18 = load i8*, i8** %9
%19 = call i32 @show_stat_info(i8* %18, %struct.stat* %3)
%20 = icmp sgt i32 %7, 2
br i1 %20, label %6, label %21
21: ; preds = %16, %2, %13
%22 = phi i32* [ @EXIT_FAILURE, %13 ], [ @EXIT_SUCCESS, %2 ], [ @EXIT_SUCCESS, %16 ]
%23 = load i32, i32* %22
ret i32 %23
}