#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 scalar_t__ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
struct tm *localtime(scalar_t__ const *);
char *malloc(int);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(scalar_t__ *);
char *utc_time(const time_t timeint) {
  struct tm *tmr;
  struct tm *now;
  time_t cur;
  char *timestr;
  time(&cur);
  now = localtime(&cur);
  tmr = timeint == 0 ? now : localtime(&timeint);
  timestr = malloc(32 * sizeof(char));
  strftime(timestr, 32, "%H:%M", tmr);
  return timestr;
}


x86 assembly (clang, -O0):
<utc_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x20(%rbp),%rdi
call   1040 <time@plt>
lea    -0x20(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    117a <utc_time+0x3a>
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
jmp    1187 <utc_time+0x47>
lea    -0x8(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x20,%edi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x20,%esi
lea    0xe4f(%rip),%rdx
call   1060 <strftime@plt>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<utc_time>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
mov    %rdi,0x8(%rsp)
lea    0x10(%rsp),%r14
mov    %r14,%rdi
call   1040 <time@plt>
mov    %r14,%rdi
call   1030 <localtime@plt>
test   %rbx,%rbx
je     1173 <utc_time+0x33>
lea    0x8(%rsp),%rdi
call   1030 <localtime@plt>
mov    %rax,%r14
mov    $0x20,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xe76(%rip),%rdx
mov    %rax,%rdi
mov    $0x20,%esi
mov    %r14,%rcx
call   1060 <strftime@plt>
mov    %rbx,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [6 x i8] c"%H:%M\00"
define i8* @utc_time(i64 %0) {
%2 = alloca i64
%3 = alloca %struct.tm*
%4 = alloca %struct.tm*
%5 = alloca i64
%6 = alloca i8*
store i64 %0, i64* %2
%7 = call i32 @time(i64* %5)
%8 = call %struct.tm* @localtime(i64* %5)
store %struct.tm* %8, %struct.tm** %4
%9 = load i64, i64* %2
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = load %struct.tm*, %struct.tm** %4
br label %15
13: ; preds = %1
%14 = call %struct.tm* @localtime(i64* %2)
br label %15
15: ; preds = %13, %11
%16 = phi %struct.tm* [ %12, %11 ], [ %14, %13 ]
store %struct.tm* %16, %struct.tm** %3
%17 = call i8* @malloc(i32 32)
store i8* %17, i8** %6
%18 = load i8*, i8** %6
%19 = load %struct.tm*, %struct.tm** %3
%20 = call i32 @strftime(i8* %18, i32 32, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), %struct.tm* %19)
%21 = load i8*, i8** %6
ret i8* %21
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [6 x i8] c"%H:%M\00"
define i8* @utc_time(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = bitcast i64* %3 to i8*
%5 = call i32 @time(i64* %3)
%6 = call %struct.tm* @localtime(i64* %3)
%7 = icmp eq i64 %0, 0
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = call %struct.tm* @localtime(i64* %2)
br label %10
10: ; preds = %1, %8
%11 = phi %struct.tm* [ %9, %8 ], [ %6, %1 ]
%12 = call dereferenceable_or_null(32) i8* @malloc(i32 32)
%13 = call i32 @strftime(i8* %12, i32 32, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), %struct.tm* %11)
ret i8* %12
}