#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;
  int tm_sec;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(char *, char *, int, int, int);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
scalar_t__ wMalloc(int);
int /*<<< orphan*/ wPushString(char *);
void wBasTime() {
  time_t t;
  struct tm *tmp;
  char *buffer = (char *)wMalloc(9);
  t = time(NULL);
  tmp = localtime(&t);
  sprintf(buffer, "%02d:%02d:%02d", tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
  wPushString(buffer);
}


x86 assembly (clang, -O0):
<wBasTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x9,%edi
call   1050 <wMalloc@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%r8d
lea    0xe61(%rip),%rsi
call   1070 <sprintf@plt>
mov    -0x18(%rbp),%rdi
call   1060 <wPushString@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wBasTime>:
push   %rbx
sub    $0x10,%rsp
mov    $0x9,%edi
call   1050 <wMalloc@plt>
mov    %rax,%rbx
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
mov    (%rax),%edx
mov    0x4(%rax),%ecx
mov    0x8(%rax),%r8d
lea    0xe79(%rip),%rsi
mov    %rbx,%rdi
call   1070 <sprintf@plt>
mov    %rbx,%rdi
call   1060 <wPushString@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32 }
@.str = [15 x i8] c"%02d:%02d:%02d\00"
define void @wBasTime() {
%1 = alloca i32
%2 = alloca %struct.tm*
%3 = alloca i8*
%4 = call i64 @wMalloc(i32 9)
%5 = inttoptr i64 %4 to i8*
store i8* %5, i8** %3
%6 = call i32 @time(i32* null)
store i32 %6, i32* %1
%7 = call %struct.tm* @localtime(i32* %1)
store %struct.tm* %7, %struct.tm** %2
%8 = load i8*, i8** %3
%9 = load %struct.tm*, %struct.tm** %2
%10 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 0
%11 = load i32, i32* %10
%12 = load %struct.tm*, %struct.tm** %2
%13 = getelementptr inbounds %struct.tm, %struct.tm* %12, i32 0, i32 1
%14 = load i32, i32* %13
%15 = load %struct.tm*, %struct.tm** %2
%16 = getelementptr inbounds %struct.tm, %struct.tm* %15, i32 0, i32 2
%17 = load i32, i32* %16
%18 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %14, i32 %17)
%19 = load i8*, i8** %3
%20 = call i32 @wPushString(i8* %19)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32 }
@.str = [15 x i8] c"%02d:%02d:%02d\00"
define void @wBasTime() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i64 @wMalloc(i32 9)
%4 = inttoptr i64 %3 to i8*
%5 = tail call i32 @time(i32* null)
store i32 %5, i32* %1
%6 = call %struct.tm* @localtime(i32* %1)
%7 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 0
%8 = load i32, i32* %7
%9 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 1
%10 = load i32, i32* %9
%11 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 2
%12 = load i32, i32* %11
%13 = call i32 @sprintf(i8* dereferenceable(1) %4, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %10, i32 %12)
%14 = call i32 @wPushString(i8* %4)
ret void
}