#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*/ time_t;
typedef int /*<<< orphan*/ ctime_str;

/* Variables and functions */
char *ctime_r(int /*<<< orphan*/ *, char *);
char *errno;
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, char const *, int /*<<< orphan*/, char *);
void display_row(const char *label, time_t t) {
  char ctime_str[256];
  memset(ctime_str, 0, sizeof(ctime_str));
  char *r = ctime_r(&t, ctime_str);
  ctime_str[sizeof(ctime_str) - 1] = '\0';
  if (r)
    printf("%-15s: % 15ld : %s", label, t, ctime_str);
  else
    printf("%-15s: % 15ld : ctime_r failed errno %d\n", label, t, errno);
}


x86 assembly (clang, -O0):
<display_row>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x110(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1040 <memset@plt>
lea    -0x110(%rbp),%rsi
lea    -0xc(%rbp),%rdi
call   1050 <ctime_r@plt>
mov    %rax,-0x118(%rbp)
movb   $0x0,-0x11(%rbp)
cmpq   $0x0,-0x118(%rbp)
je     119d <display_row+0x6d>
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
lea    -0x110(%rbp),%rcx
lea    0xe6d(%rip),%rdi
call   1030 <printf@plt>
jmp    11ba <display_row+0x8a>
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    0x2e35(%rip),%rax
mov    (%rax),%rcx
lea    0xe5e(%rip),%rdi
call   1030 <printf@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_row>:
push   %r14
push   %rbx
sub    $0x118,%rsp
mov    %rdi,%r14
mov    %esi,0xc(%rsp)
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1040 <memset@plt>
lea    0xc(%rsp),%rdi
mov    %rbx,%rsi
call   1050 <ctime_r@plt>
movb   $0x0,0x10f(%rsp)
mov    0xc(%rsp),%edx
test   %rax,%rax
je     1181 <display_row+0x51>
lea    0xe86(%rip),%rdi
lea    0x10(%rsp),%rcx
jmp    1192 <display_row+0x62>
mov    0x2e58(%rip),%rax
mov    (%rax),%rcx
lea    0xe81(%rip),%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
add    $0x118,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [19 x i8] c"%-15s: % 15ld : %s\00"
@.str.1 = [41 x i8] c"%-15s: % 15ld : ctime_r failed errno %d\0A\00"
@errno = global i8* null
define void @display_row(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [256 x i8]
%6 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%8 = call i32 @memset(i8* %7, i32 0, i32 256)
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%10 = call i8* @ctime_r(i32* %4, i8* %9)
store i8* %10, i8** %6
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 255
store i8 0, i8* %11
%12 = load i8*, i8** %6
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %19
14: ; preds = %2
%15 = load i8*, i8** %3
%16 = load i32, i32* %4
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%18 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %15, i32 %16, i8* %17)
br label %24
19: ; preds = %2
%20 = load i8*, i8** %3
%21 = load i32, i32* %4
%22 = load i8*, i8** @errno
%23 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i8* %20, i32 %21, i8* %22)
br label %24
24: ; preds = %19, %14
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"%-15s: % 15ld : %s\00"
@.str.1 = [41 x i8] c"%-15s: % 15ld : ctime_r failed errno %d\0A\00"
@errno = global i8* null
define void @display_row(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca [256 x i8]
store i32 %1, i32* %3
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%6 = call i32 @memset(i8* %5, i32 0, i32 256)
%7 = call i8* @ctime_r(i32* %3, i8* %5)
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 255
store i8 0, i8* %8
%9 = icmp eq i8* %7, null
%10 = load i32, i32* %3
br i1 %9, label %13, label %11
11: ; preds = %2
%12 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %10, i8* %5)
br label %16
13: ; preds = %2
%14 = load i8*, i8** @errno
%15 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 %10, i8* %14)
br label %16
16: ; preds = %13, %11
ret void
}