#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 {
  int tm_hour;
  int tm_min;
};

/* Variables and functions */
struct tm *gmtime(int /*<<< orphan*/ *);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(char *, char *, int, int);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
char *time_stamp(int utc) {
  struct tm *cas;
  static char tt[32];
  time_t secs = time(NULL);
  if (utc)
    cas = gmtime(&secs);
  else
    cas = localtime(&secs);
  sprintf(tt, "%2i:%02i", cas->tm_hour, cas->tm_min);
  return tt;
}


x86 assembly (clang, -O0):
<time_stamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1173 <time_stamp+0x33>
lea    -0x14(%rbp),%rdi
call   1050 <gmtime@plt>
mov    %rax,-0x10(%rbp)
jmp    1180 <time_stamp+0x40>
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%ecx
lea    0x2ebc(%rip),%rdi
lea    0xe65(%rip),%rsi
call   1060 <sprintf@plt>
lea    0x2ea9(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_stamp>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
test   %ebx,%ebx
je     1162 <time_stamp+0x22>
call   1050 <gmtime@plt>
jmp    1167 <time_stamp+0x27>
call   1030 <localtime@plt>
mov    (%rax),%edx
mov    0x4(%rax),%ecx
lea    0x2edd(%rip),%rbx
lea    0xe86(%rip),%rsi
mov    %rbx,%rdi
call   1060 <sprintf@plt>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32 }
@time_stamp.tt = internal global [32 x i8] zeroinitializer
@.str = [9 x i8] c"%2i:%02i\00"
define i8* @time_stamp(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.tm*
%4 = alloca i32
store i32 %0, i32* %2
%5 = call i32 @time(i32* null)
store i32 %5, i32* %4
%6 = load i32, i32* %2
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call %struct.tm* @gmtime(i32* %4)
store %struct.tm* %9, %struct.tm** %3
br label %12
10: ; preds = %1
%11 = call %struct.tm* @localtime(i32* %4)
store %struct.tm* %11, %struct.tm** %3
br label %12
12: ; preds = %10, %8
%13 = load %struct.tm*, %struct.tm** %3
%14 = getelementptr inbounds %struct.tm, %struct.tm* %13, i32 0, i32 0
%15 = load i32, i32* %14
%16 = load %struct.tm*, %struct.tm** %3
%17 = getelementptr inbounds %struct.tm, %struct.tm* %16, i32 0, i32 1
%18 = load i32, i32* %17
%19 = call i32 @sprintf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @time_stamp.tt, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %15, i32 %18)
ret i8* getelementptr inbounds ([32 x i8], [32 x i8]* @time_stamp.tt, i64 0, i64 0)
}

LLVM IR (-O2):
%struct.tm = type { i32, i32 }
@time_stamp.tt = internal global [32 x i8] zeroinitializer
@.str = [9 x i8] c"%2i:%02i\00"
define i8* @time_stamp(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 @time(i32* null)
store i32 %4, i32* %2
%5 = icmp eq i32 %0, 0
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = call %struct.tm* @gmtime(i32* %2)
br label %10
8: ; preds = %1
%9 = call %struct.tm* @localtime(i32* %2)
br label %10
10: ; preds = %8, %6
%11 = phi %struct.tm* [ %7, %6 ], [ %9, %8 ]
%12 = getelementptr inbounds %struct.tm, %struct.tm* %11, i64 0, i32 0
%13 = load i32, i32* %12
%14 = getelementptr inbounds %struct.tm, %struct.tm* %11, i64 0, i32 1
%15 = load i32, i32* %14
%16 = call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @time_stamp.tt, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %15)
ret i8* getelementptr inbounds ([32 x i8], [32 x i8]* @time_stamp.tt, i64 0, i64 0)
}