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

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ stat(char const *, struct stat *);
void ldump(const char *nfile, const char *datafile, int copies) {
  struct stat lbuf;
  putchar('\t');
  if (copies > 1)
    printf("%-2d copies of %-19s", copies, nfile);
  else
    printf("%-32s", nfile);
  if (*datafile && !stat(datafile, &lbuf))
    printf(" %qd bytes", (long long)lbuf.st_size);
  else
    printf(" ??? bytes");
  putchar('\n');
}


x86 assembly (clang, -O0):
<ldump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0x9,%edi
call   1030 <putchar@plt>
cmpl   $0x1,-0x14(%rbp)
jle    1171 <ldump+0x41>
mov    -0x14(%rbp),%esi
mov    -0x8(%rbp),%rdx
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1183 <ldump+0x53>
mov    -0x8(%rbp),%rsi
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11c0 <ldump+0x90>
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1050 <stat@plt>
cmp    $0x0,%eax
jne    11c0 <ldump+0x90>
mov    -0x20(%rbp),%rsi
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11ce <ldump+0x9e>
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ldump>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    $0x9,%edi
call   1030 <putchar@plt>
cmp    $0x2,%ebp
jl     116a <ldump+0x3a>
lea    0xeaa(%rip),%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
cmpb   $0x0,(%r14)
jne    1181 <ldump+0x51>
jmp    1192 <ldump+0x62>
lea    0xea4(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
cmpb   $0x0,(%r14)
je     1192 <ldump+0x62>
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1050 <stat@plt>
test   %eax,%eax
je     11a2 <ldump+0x72>
lea    0xe8d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11b5 <ldump+0x85>
mov    0x8(%rsp),%rsi
lea    0xe6d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
%struct.stat = type { i64 }
@.str = [21 x i8] c"%-2d copies of %-19s\00"
@.str.1 = [6 x i8] c"%-32s\00"
@.str.2 = [11 x i8] c" %qd bytes\00"
@.str.3 = [11 x i8] c" ??? bytes\00"
define void @ldump(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca %struct.stat
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = call i32 @putchar(i8 signext 9)
%9 = load i32, i32* %6
%10 = icmp sgt i32 %9, 1
br i1 %10, label %11, label %15
11: ; preds = %3
%12 = load i32, i32* %6
%13 = load i8*, i8** %4
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %12, i8* %13)
br label %18
15: ; preds = %3
%16 = load i8*, i8** %4
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %16)
br label %18
18: ; preds = %15, %11
%19 = load i8*, i8** %5
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %31
23: ; preds = %18
%24 = load i8*, i8** %5
%25 = call i32 @stat(i8* %24, %struct.stat* %7)
%26 = icmp ne i32 %25, 0
br i1 %26, label %31, label %27
27: ; preds = %23
%28 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 0
%29 = load i64, i64* %28
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i64 %29)
br label %33
31: ; preds = %23, %18
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %33
33: ; preds = %31, %27
%34 = call i32 @putchar(i8 signext 10)
ret void
}

LLVM IR (-O2):
%struct.stat = type { i64 }
@.str = [21 x i8] c"%-2d copies of %-19s\00"
@.str.1 = [6 x i8] c"%-32s\00"
@.str.2 = [11 x i8] c" %qd bytes\00"
@.str.3 = [11 x i8] c" ??? bytes\00"
define void @ldump(i8* %0, i8* nocapture %1, i32 %2) {
%4 = alloca %struct.stat
%5 = bitcast %struct.stat* %4 to i8*
%6 = tail call i32 @putchar(i8 signext 9)
%7 = icmp sgt i32 %2, 1
br i1 %7, label %8, label %10
8: ; preds = %3
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %2, i8* %0)
br label %12
10: ; preds = %3
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %12
12: ; preds = %10, %8
%13 = load i8, i8* %1
%14 = icmp eq i8 %13, 0
br i1 %14, label %22, label %15
15: ; preds = %12
%16 = call i32 @stat(i8* %1, %struct.stat* %4)
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 0
%20 = load i64, i64* %19
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i64 %20)
br label %24
22: ; preds = %15, %12
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %24
24: ; preds = %22, %18
%25 = tail call i32 @putchar(i8 signext 10)
ret void
}