#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;
struct tm {
  scalar_t__ tm_yday;
  int tm_hour;
  int tm_min;
};
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
struct tm *gmtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ snprintf(char *, int, char *, int, int, ...);
char *time_format_1(time_t dt) {
  struct tm *delta;
  static char buf[64];
  delta = gmtime((time_t *)&dt);
  if (delta->tm_yday > 0)
    snprintf(buf, sizeof(buf), "%dd %02d:%02d", delta->tm_yday, delta->tm_hour,
             delta->tm_min);
  else
    snprintf(buf, sizeof(buf), "%02d:%02d", delta->tm_hour, delta->tm_min);
  return buf;
}


x86 assembly (clang, -O0):
<time_format_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
call   1040 <gmtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
jle    117e <time_format_1+0x5e>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%r8d
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%r9d
lea    0x2eda(%rip),%rdi
mov    $0x40,%esi
lea    0xe8e(%rip),%rdx
mov    $0x0,%al
call   1030 <snprintf@plt>
jmp    11a7 <time_format_1+0x87>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%r8d
lea    0x2eac(%rip),%rdi
mov    $0x40,%esi
lea    0xe64(%rip),%rdx
mov    $0x0,%al
call   1030 <snprintf@plt>
lea    0x2e92(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_format_1>:
push   %rax
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1040 <gmtime@plt>
mov    (%rax),%rcx
test   %rcx,%rcx
jle    115b <time_format_1+0x3b>
mov    0x8(%rax),%r8d
mov    0xc(%rax),%r9d
lea    0x2efa(%rip),%rdi
lea    0xeb3(%rip),%rdx
mov    $0x40,%esi
xor    %eax,%eax
call   1030 <snprintf@plt>
jmp    117c <time_format_1+0x5c>
mov    0x8(%rax),%ecx
mov    0xc(%rax),%r8d
lea    0x2ed7(%rip),%rdi
lea    0xe94(%rip),%rdx
mov    $0x40,%esi
xor    %eax,%eax
call   1030 <snprintf@plt>
lea    0x2ebd(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.tm = type { i64, i32, i32 }
@time_format_1.buf = internal global [64 x i8] zeroinitializer
@.str = [14 x i8] c"%dd %02d:%02d\00"
@.str.1 = [10 x i8] c"%02d:%02d\00"
define i8* @time_format_1(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.tm*
store i32 %0, i32* %2
%4 = call %struct.tm* @gmtime(i32* %2)
store %struct.tm* %4, %struct.tm** %3
%5 = load %struct.tm*, %struct.tm** %3
%6 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 0
%7 = load i64, i64* %6
%8 = icmp sgt i64 %7, 0
br i1 %8, label %9, label %21
9: ; preds = %1
%10 = load %struct.tm*, %struct.tm** %3
%11 = getelementptr inbounds %struct.tm, %struct.tm* %10, i32 0, i32 0
%12 = load i64, i64* %11
%13 = trunc i64 %12 to i32
%14 = load %struct.tm*, %struct.tm** %3
%15 = getelementptr inbounds %struct.tm, %struct.tm* %14, i32 0, i32 1
%16 = load i32, i32* %15
%17 = load %struct.tm*, %struct.tm** %3
%18 = getelementptr inbounds %struct.tm, %struct.tm* %17, i32 0, i32 2
%19 = load i32, i32* %18
%20 = call i32 (i8*, i32, i8*, i32, i32, ...) @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @time_format_1.buf, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %16, i32 %19)
br label %29
21: ; preds = %1
%22 = load %struct.tm*, %struct.tm** %3
%23 = getelementptr inbounds %struct.tm, %struct.tm* %22, i32 0, i32 1
%24 = load i32, i32* %23
%25 = load %struct.tm*, %struct.tm** %3
%26 = getelementptr inbounds %struct.tm, %struct.tm* %25, i32 0, i32 2
%27 = load i32, i32* %26
%28 = call i32 (i8*, i32, i8*, i32, i32, ...) @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @time_format_1.buf, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %24, i32 %27)
br label %29
29: ; preds = %21, %9
ret i8* getelementptr inbounds ([64 x i8], [64 x i8]* @time_format_1.buf, i64 0, i64 0)
}

LLVM IR (-O2):
%struct.tm = type { i64, i32, i32 }
@time_format_1.buf = internal global [64 x i8] zeroinitializer
@.str = [14 x i8] c"%dd %02d:%02d\00"
@.str.1 = [10 x i8] c"%02d:%02d\00"
define i8* @time_format_1(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call %struct.tm* @gmtime(i32* %2)
%4 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 0
%5 = load i64, i64* %4
%6 = icmp sgt i64 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %1
%8 = trunc i64 %5 to i32
%9 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 1
%10 = load i32, i32* %9
%11 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 2
%12 = load i32, i32* %11
%13 = call i32 (i8*, i32, i8*, i32, i32, ...) @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @time_format_1.buf, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %10, i32 %12)
br label %20
14: ; preds = %1
%15 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 1
%16 = load i32, i32* %15
%17 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 2
%18 = load i32, i32* %17
%19 = call i32 (i8*, i32, i8*, i32, i32, ...) @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @time_format_1.buf, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %16, i32 %18)
br label %20
20: ; preds = %14, %7
ret i8* getelementptr inbounds ([64 x i8], [64 x i8]* @time_format_1.buf, i64 0, i64 0)
}