#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 /*<<< orphan*/ tm_sec;
  int /*<<< orphan*/ tm_min;
  int /*<<< orphan*/ tm_hour;
};

/* Variables and functions */
char *int_to_binstr(int /*<<< orphan*/, int);
struct tm *localtime(int /*<<< orphan*/ *);
char *malloc(int);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
char *get_bintime() {
  char *bintime;
  bintime = malloc(20);
  time_t rawtime;
  rawtime = time(NULL);
  struct tm *timeinfo = localtime(&rawtime);
  sprintf(bintime, "%s:%s:%s\n", int_to_binstr(timeinfo->tm_hour, 6),
          int_to_binstr(timeinfo->tm_min, 6),
          int_to_binstr(timeinfo->tm_sec, 6));
  return bintime;
}


x86 assembly (clang, -O0):
<get_bintime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    $0x14,%edi
call   1060 <malloc@plt>
mov    %rax,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0xc(%rbp)
lea    -0xc(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%edi
mov    $0x6,%esi
call   1050 <int_to_binstr@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%edi
mov    $0x6,%esi
call   1050 <int_to_binstr@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
mov    $0x6,%esi
call   1050 <int_to_binstr@plt>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    %rax,%r8
lea    0xe29(%rip),%rsi
call   1070 <sprintf@plt>
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_bintime>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    $0x14,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <localtime@plt>
mov    %rax,%rbx
mov    0x8(%rax),%edi
mov    $0x6,%esi
call   1050 <int_to_binstr@plt>
mov    %rax,%r15
mov    0x4(%rbx),%edi
mov    $0x6,%esi
call   1050 <int_to_binstr@plt>
mov    %rax,%r12
mov    (%rbx),%edi
mov    $0x6,%esi
call   1050 <int_to_binstr@plt>
lea    0xe50(%rip),%rsi
mov    %r14,%rdi
mov    %r15,%rdx
mov    %r12,%rcx
mov    %rax,%r8
call   1070 <sprintf@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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