#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 */
typedef int /*<<< orphan*/ tmp;
struct tm {
  int dummy;
};
struct ar_hdr {
  char *ar_mode;
  char *ar_date;
  char *ar_name;
  int /*<<< orphan*/ ar_size;
  int /*<<< orphan*/ ar_gid;
  int /*<<< orphan*/ ar_uid;
};

/* Variables and functions */
int atoi(int /*<<< orphan*/);
char *file_perm_string(int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, ...);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ strptime(char *, char *, struct tm *);
int strtol(char *, int /*<<< orphan*/ *, int);
void print_table(struct ar_hdr header, int verbose) {
  char buf[200];
  char tmp[20];
  char time_str[20];
  int mode;
  struct tm time;
  if (verbose) {
    snprintf(tmp, 8, "%s", header.ar_mode);
    mode = strtol(tmp, NULL, 8);
    snprintf(tmp, 16, "%s", header.ar_date);
    strptime(tmp, "%s", &time);
    strftime(time_str, sizeof(tmp), "%b %d %H:%M %Y", &time);
    snprintf(tmp, 16, "%s", header.ar_name);
    snprintf(buf, 200, "%s %d/%d %6d %s %s", file_perm_string(mode, 0),
             atoi(header.ar_uid), atoi(header.ar_gid), atoi(header.ar_size),
             time_str, tmp);
  } else {
    snprintf(buf, sizeof(header.ar_name), "%s", header.ar_name);
  }
  printf("%s\n", buf);
}


x86 assembly (clang, -O0):
<print_table>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
lea    0x10(%rbp),%rax
mov    %rax,-0x120(%rbp)
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     130c <print_table+0x19c>
mov    -0x120(%rbp),%rax
lea    -0xf0(%rbp),%rdi
mov    (%rax),%rcx
mov    $0x8,%esi
lea    0xe6f(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
lea    -0xf0(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x8,%edx
call   1050 <strtol@plt>
mov    %eax,%ecx
mov    -0x120(%rbp),%rax
mov    %ecx,-0x114(%rbp)
lea    -0xf0(%rbp),%rdi
mov    0x8(%rax),%rcx
mov    $0x10,%esi
lea    0xe2d(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
lea    -0xf0(%rbp),%rdi
lea    0xe18(%rip),%rsi
lea    -0x118(%rbp),%rdx
call   1090 <strptime@plt>
lea    -0x110(%rbp),%rdi
mov    $0x14,%esi
lea    0xdda(%rip),%rdx
lea    -0x118(%rbp),%rcx
call   1060 <strftime@plt>
mov    -0x120(%rbp),%rax
lea    -0xf0(%rbp),%rdi
mov    0x10(%rax),%rcx
mov    $0x10,%esi
lea    0xdcf(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
lea    -0xd0(%rbp),%rax
mov    %rax,-0x138(%rbp)
mov    -0x114(%rbp),%edi
xor    %esi,%esi
call   1070 <file_perm_string@plt>
mov    %rax,%rcx
mov    -0x120(%rbp),%rax
mov    %rcx,-0x130(%rbp)
mov    0x20(%rax),%edi
call   1080 <atoi@plt>
mov    %eax,%ecx
mov    -0x120(%rbp),%rax
mov    %ecx,-0x128(%rbp)
mov    0x1c(%rax),%edi
call   1080 <atoi@plt>
mov    %eax,%ecx
mov    -0x120(%rbp),%rax
mov    %ecx,-0x124(%rbp)
mov    0x18(%rax),%edi
call   1080 <atoi@plt>
mov    -0x138(%rbp),%rdi
mov    -0x130(%rbp),%rcx
mov    -0x128(%rbp),%r8d
mov    -0x124(%rbp),%r9d
mov    %eax,%r11d
lea    -0x110(%rbp),%r10
lea    -0xf0(%rbp),%rax
mov    $0xc8,%esi
lea    0xd1d(%rip),%rdx
mov    %r11d,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
mov    $0x0,%al
call   1040 <snprintf@plt>
jmp    1331 <print_table+0x1c1>
mov    -0x120(%rbp),%rax
lea    -0xd0(%rbp),%rdi
mov    0x10(%rax),%rcx
mov    $0x8,%esi
lea    0xcf5(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
lea    -0xd0(%rbp),%rsi
lea    0xce3(%rip),%rdi
call   1030 <printf@plt>
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_table>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x118,%rsp
lea    0x150(%rsp),%r14
test   %edi,%edi
je     127f <print_table+0x10f>
mov    (%r14),%rcx
lea    0xe84(%rip),%rbx
lea    0x30(%rsp),%r15
mov    %r15,%rdi
mov    $0x8,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <snprintf@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1050 <strtol@plt>
mov    %eax,%r12d
mov    0x8(%r14),%rcx
mov    %r15,%rdi
mov    $0x10,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <snprintf@plt>
lea    0x8(%rsp),%rbp
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
call   1090 <strptime@plt>
lea    0xe0c(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    $0x14,%esi
mov    %rbp,%rcx
call   1060 <strftime@plt>
mov    0x10(%r14),%rcx
mov    %r15,%rdi
mov    $0x10,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <snprintf@plt>
mov    %r12d,%edi
xor    %esi,%esi
call   1070 <file_perm_string@plt>
mov    %rax,%r12
mov    0x20(%r14),%edi
call   1080 <atoi@plt>
mov    %eax,%r13d
mov    0x1c(%r14),%edi
call   1080 <atoi@plt>
mov    %eax,%ebx
mov    0x18(%r14),%edi
call   1080 <atoi@plt>
mov    %eax,%ebp
sub    $0x8,%rsp
lea    0xdb9(%rip),%rdx
lea    0x58(%rsp),%rdi
mov    $0xc8,%esi
mov    %r12,%rcx
mov    %r13d,%r8d
mov    %ebx,%r9d
xor    %eax,%eax
push   %r15
lea    0x20(%rsp),%rbx
push   %rbx
push   %rbp
call   1040 <snprintf@plt>
add    $0x20,%rsp
jmp    129b <print_table+0x12b>
mov    0x10(%r14),%rcx
lea    0xd95(%rip),%rdx
lea    0x50(%rsp),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1040 <snprintf@plt>
lea    0xd80(%rip),%rdi
lea    0x50(%rsp),%rsi
call   1030 <printf@plt>
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.ar_hdr = type { i8*, i8*, i8*, i32, i32, i32 }
%struct.tm = type { i32 }
@.str = [3 x i8] c"%s\00"
@.str.1 = [15 x i8] c"%b %d %H:%M %Y\00"
@.str.2 = [19 x i8] c"%s %d/%d %6d %s %s\00"
@.str.3 = [4 x i8] c"%s\0A\00"
define void @print_table(%struct.ar_hdr* byval(%struct.ar_hdr) align 8 %0, i32 %1) {
%3 = alloca i32
%4 = alloca [200 x i8]
%5 = alloca [20 x i8]
%6 = alloca [20 x i8]
%7 = alloca i32
%8 = alloca %struct.tm
store i32 %1, i32* %3
%9 = load i32, i32* %3
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %45
11: ; preds = %2
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%13 = getelementptr inbounds %struct.ar_hdr, %struct.ar_hdr* %0, i32 0, i32 0
%14 = load i8*, i8** %13
%15 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %12, i32 8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%17 = call i32 @strtol(i8* %16, i32* null, i32 8)
store i32 %17, i32* %7
%18 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%19 = getelementptr inbounds %struct.ar_hdr, %struct.ar_hdr* %0, i32 0, i32 1
%20 = load i8*, i8** %19
%21 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %18, i32 16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %20)
%22 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%23 = call i32 @strptime(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), %struct.tm* %8)
%24 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%25 = call i32 @strftime(i8* %24, i32 20, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %8)
%26 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%27 = getelementptr inbounds %struct.ar_hdr, %struct.ar_hdr* %0, i32 0, i32 2
%28 = load i8*, i8** %27
%29 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %26, i32 16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %28)
%30 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%31 = load i32, i32* %7
%32 = call i8* @file_perm_string(i32 %31, i32 0)
%33 = getelementptr inbounds %struct.ar_hdr, %struct.ar_hdr* %0, i32 0, i32 5
%34 = load i32, i32* %33
%35 = call i32 @atoi(i32 %34)
%36 = getelementptr inbounds %struct.ar_hdr, %struct.ar_hdr* %0, i32 0, i32 4
%37 = load i32, i32* %36
%38 = call i32 @atoi(i32 %37)
%39 = getelementptr inbounds %struct.ar_hdr, %struct.ar_hdr* %0, i32 0, i32 3
%40 = load i32, i32* %39
%41 = call i32 @atoi(i32 %40)
%42 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%43 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%44 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %30, i32 200, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %32, i32 %35, i32 %38, i32 %41, i8* %42, i8* %43)
br label %50
45: ; preds = %2
%46 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%47 = getelementptr inbounds %struct.ar_hdr, %struct.ar_hdr* %0, i32 0, i32 2
%48 = load i8*, i8** %47
%49 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %46, i32 8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %48)
br label %50
50: ; preds = %45, %11
%51 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%52 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %51)
ret void
}

LLVM IR (-O2):
%struct.ar_hdr = type { i8*, i8*, i8*, i32, i32, i32 }
%struct.tm = type { i32 }
@.str = [3 x i8] c"%s\00"
@.str.1 = [15 x i8] c"%b %d %H:%M %Y\00"
@.str.2 = [19 x i8] c"%s %d/%d %6d %s %s\00"
@.str.3 = [4 x i8] c"%s\0A\00"
define void @print_table(%struct.ar_hdr* nocapture byval(%struct.ar_hdr) align 8 %0, i32 %1) {
%3 = alloca [200 x i8]
%4 = alloca [20 x i8]
%5 = alloca [20 x i8]
%6 = alloca %struct.tm
%7 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%10 = bitcast %struct.tm* %6 to i8*
%11 = icmp eq i32 %1, 0
br i1 %11, label %36, label %12
12: ; preds = %2
%13 = getelementptr inbounds %struct.ar_hdr, %struct.ar_hdr* %0, i64 0, i32 0
%14 = load i8*, i8** %13
%15 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %8, i32 8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = call i32 @strtol(i8* nocapture %8, i32* null, i32 8)
%17 = getelementptr inbounds %struct.ar_hdr, %struct.ar_hdr* %0, i64 0, i32 1
%18 = load i8*, i8** %17
%19 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %8, i32 16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %18)
%20 = call i32 @strptime(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), %struct.tm* %6)
%21 = call i32 @strftime(i8* %9, i32 20, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %6)
%22 = getelementptr inbounds %struct.ar_hdr, %struct.ar_hdr* %0, i64 0, i32 2
%23 = load i8*, i8** %22
%24 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %8, i32 16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %23)
%25 = call i8* @file_perm_string(i32 %16, i32 0)
%26 = getelementptr inbounds %struct.ar_hdr, %struct.ar_hdr* %0, i64 0, i32 5
%27 = load i32, i32* %26
%28 = call i32 @atoi(i32 %27)
%29 = getelementptr inbounds %struct.ar_hdr, %struct.ar_hdr* %0, i64 0, i32 4
%30 = load i32, i32* %29
%31 = call i32 @atoi(i32 %30)
%32 = getelementptr inbounds %struct.ar_hdr, %struct.ar_hdr* %0, i64 0, i32 3
%33 = load i32, i32* %32
%34 = call i32 @atoi(i32 %33)
%35 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %7, i32 200, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %25, i32 %28, i32 %31, i32 %34, i8* %9, i8* %8)
br label %40
36: ; preds = %2
%37 = getelementptr inbounds %struct.ar_hdr, %struct.ar_hdr* %0, i64 0, i32 2
%38 = load i8*, i8** %37
%39 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %7, i32 8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %38)
br label %40
40: ; preds = %36, %12
%41 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %7)
ret void
}