#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_mtime;
  scalar_t__ st_size;
};

/* Variables and functions */
int /*<<< orphan*/ ctime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
scalar_t__ stat(char *, struct stat *);
void ldump(char *nfile, char *file, int copies) {
  struct stat lbuf;
  putchar('\t');
  if (copies > 1)
    printf("%-2d copies of %-19s", copies, nfile);
  else
    printf("%-32s", nfile);
  if (*file && stat(file, &lbuf) == 0)
    printf(" %8lld bytes -- %s", (long long)lbuf.st_size,
           ctime(&lbuf.st_mtime));
  else
    printf(" ??? bytes\n");
}


x86 assembly (clang, -O0):
<ldump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%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    1181 <ldump+0x41>
mov    -0x14(%rbp),%esi
mov    -0x8(%rbp),%rdx
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1193 <ldump+0x53>
mov    -0x8(%rbp),%rsi
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11e4 <ldump+0xa4>
mov    -0x10(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1060 <stat@plt>
cmp    $0x0,%rax
jne    11e4 <ldump+0xa4>
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    -0x28(%rbp),%rdi
call   1040 <ctime@plt>
mov    -0x30(%rbp),%rsi
mov    %eax,%edx
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    11f2 <ldump+0xb2>
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
add    $0x30,%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     118a <ldump+0x3a>
lea    0xe8a(%rip),%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1060 <printf@plt>
cmpb   $0x0,(%r14)
jne    11a1 <ldump+0x51>
jmp    11b1 <ldump+0x61>
lea    0xe84(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
cmpb   $0x0,(%r14)
je     11b1 <ldump+0x61>
mov    %rsp,%rsi
mov    %r14,%rdi
call   1070 <stat@plt>
test   %rax,%rax
je     11bf <ldump+0x6f>
lea    0xe76(%rip),%rdi
call   1040 <puts@plt>
jmp    11df <ldump+0x8f>
mov    0x8(%rsp),%rbx
mov    %rsp,%rdi
call   1050 <ctime@plt>
lea    0xe48(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32, i64 }
@.str = [21 x i8] c"%-2d copies of %-19s\00"
@.str.1 = [6 x i8] c"%-32s\00"
@.str.2 = [19 x i8] c" %8lld bytes -- %s\00"
@.str.3 = [12 x i8] c" ??? bytes\0A\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 %33
23: ; preds = %18
%24 = load i8*, i8** %5
%25 = call i64 @stat(i8* %24, %struct.stat* %7)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %33
27: ; preds = %23
%28 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 1
%29 = load i64, i64* %28
%30 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 0
%31 = call i32 @ctime(i32* %30)
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i64 %29, i32 %31)
br label %35
33: ; preds = %23, %18
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %35
35: ; preds = %33, %27
ret void
}

LLVM IR (-O2):
%struct.stat = type { i32, i64 }
@.str = [21 x i8] c"%-2d copies of %-19s\00"
@.str.1 = [6 x i8] c"%-32s\00"
@.str.2 = [19 x i8] c" %8lld bytes -- %s\00"
@str = [11 x i8] c" ??? bytes\00"
define void @ldump(i8* %0, i8* %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 %24, label %15
15: ; preds = %12
%16 = call i64 @stat(i8* %1, %struct.stat* %4)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %15
%19 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 1
%20 = load i64, i64* %19
%21 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 0
%22 = call i32 @ctime(i32* %21)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i64 %20, i32 %22)
br label %26
24: ; preds = %15, %12
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
br label %26
26: ; preds = %24, %18
ret void
}