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

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
scalar_t__ lstat(char *, struct stat *);
int /*<<< orphan*/ printf(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  struct stat buf;
  while (--argc > 0) {
    if (lstat(*++argv, &buf) < 0) {
      fprintf(stderr, "lstat error on file '%s'\n", *argv);
      continue;
    }
    printf("file size of '%s' is %ld\n", *argv, buf.st_size);
  }
  return 0;
}


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    11ba <main+0x8a>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <lstat@plt>
cmp    $0x0,%rax
jge    119f <main+0x6f>
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe6b(%rip),%rsi
call   1050 <fprintf@plt>
jmp    1146 <main+0x16>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x18(%rbp),%edx
lea    0xe6a(%rip),%rdi
call   1030 <printf@plt>
jmp    1146 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     11ab <main+0x7b>
mov    %rsi,%rbx
mov    %edi,%ebp
add    $0x1,%ebp
add    $0x8,%rbx
mov    %rsp,%r14
mov    0x2e8a(%rip),%r13
lea    0xea3(%rip),%r15
lea    0xeb6(%rip),%r12
jmp    118b <main+0x5b>
cs nopw 0x0(%rax,%rax,1)
mov    0x0(%r13),%edi
mov    (%rbx),%rdx
mov    %r15,%rsi
call   1050 <fprintf@plt>
add    $0xffffffff,%ebp
add    $0x8,%rbx
cmp    $0x2,%ebp
jbe    11ab <main+0x7b>
mov    (%rbx),%rdi
mov    %r14,%rsi
call   1040 <lstat@plt>
test   %rax,%rax
js     1170 <main+0x40>
mov    (%rbx),%rsi
mov    (%rsp),%edx
mov    %r12,%rdi
call   1030 <printf@plt>
jmp    117f <main+0x4f>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@stderr = global i32 0
@.str = [26 x i8] c"lstat error on file '%s'\0A\00"
@.str.1 = [26 x i8] c"file size of '%s' is %ld\0A\00"
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, %17, %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 %28
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 i64 @lstat(i8* %14, %struct.stat* %6)
%16 = icmp slt i64 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %11
%18 = load i32, i32* @stderr
%19 = load i8**, i8*** %5
%20 = load i8*, i8** %19
%21 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %20)
br label %7
22: ; preds = %11
%23 = load i8**, i8*** %5
%24 = load i8*, i8** %23
%25 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%26 = load i32, i32* %25
%27 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %24, i32 %26)
br label %7
28: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@stderr = global i32 0
@.str = [26 x i8] c"lstat error on file '%s'\0A\00"
@.str.1 = [26 x i8] c"file size of '%s' is %ld\0A\00"
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 %26
6: ; preds = %2
%7 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
br label %8
8: ; preds = %6, %20
%9 = phi i32 [ %0, %6 ], [ %11, %20 ]
%10 = phi i8** [ %1, %6 ], [ %12, %20 ]
%11 = add nsw i32 %9, -1
%12 = getelementptr inbounds i8*, i8** %10, i64 1
%13 = load i8*, i8** %12
%14 = call i64 @lstat(i8* %13, %struct.stat* %3)
%15 = icmp slt i64 %14, 0
br i1 %15, label %16, label %22
16: ; preds = %8
%17 = load i32, i32* @stderr
%18 = load i8*, i8** %12
%19 = tail call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %18)
br label %20
20: ; preds = %16, %22
%21 = icmp ugt i32 %9, 2
br i1 %21, label %8, label %26
22: ; preds = %8
%23 = load i8*, i8** %12
%24 = load i32, i32* %7
%25 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %23, i32 %24)
br label %20
26: ; preds = %20, %2
ret i32 0
}