#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 *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void show_prompt() {
  time_t curtime;
  struct tm *loctime;
  curtime = time(NULL);
  loctime = localtime(&curtime);
  printf("<");
  if (loctime->tm_hour < 10)
    printf("0%d:", loctime->tm_hour);
  else
    printf("%d:", loctime->tm_hour);
  if (loctime->tm_min < 10)
    printf("0%d#> ", loctime->tm_min);
  else
    printf("%d#> ", loctime->tm_min);
}


x86 assembly (clang, -O0):
<show_prompt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
cmpl   $0xa,(%rax)
jge    1185 <show_prompt+0x55>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1199 <show_prompt+0x69>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
cmpl   $0xa,0x4(%rax)
jge    11c1 <show_prompt+0x91>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%esi
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11d6 <show_prompt+0xa6>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%esi
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_prompt>:
push   %rbx
sub    $0x10,%rsp
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1040 <localtime@plt>
mov    %rax,%rbx
mov    $0x3c,%edi
call   1030 <putchar@plt>
mov    (%rbx),%esi
cmp    $0xa,%esi
lea    0xe8d(%rip),%rax
lea    0xe87(%rip),%rdi
cmovl  %rax,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rbx),%esi
cmp    $0xa,%esi
lea    0xe73(%rip),%rax
lea    0xe6d(%rip),%rdi
cmovl  %rax,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32 }
@.str = [2 x i8] c"<\00"
@.str.1 = [5 x i8] c"0%d:\00"
@.str.2 = [4 x i8] c"%d:\00"
@.str.3 = [7 x i8] c"0%d#> \00"
@.str.4 = [6 x i8] c"%d#> \00"
define void @show_prompt() {
%1 = alloca i32
%2 = alloca %struct.tm*
%3 = call i32 @time(i32* null)
store i32 %3, i32* %1
%4 = call %struct.tm* @localtime(i32* %1)
store %struct.tm* %4, %struct.tm** %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = load %struct.tm*, %struct.tm** %2
%7 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 0
%8 = load i32, i32* %7
%9 = icmp slt i32 %8, 10
br i1 %9, label %10, label %15
10: ; preds = %0
%11 = load %struct.tm*, %struct.tm** %2
%12 = getelementptr inbounds %struct.tm, %struct.tm* %11, i32 0, i32 0
%13 = load i32, i32* %12
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %13)
br label %20
15: ; preds = %0
%16 = load %struct.tm*, %struct.tm** %2
%17 = getelementptr inbounds %struct.tm, %struct.tm* %16, i32 0, i32 0
%18 = load i32, i32* %17
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %18)
br label %20
20: ; preds = %15, %10
%21 = load %struct.tm*, %struct.tm** %2
%22 = getelementptr inbounds %struct.tm, %struct.tm* %21, i32 0, i32 1
%23 = load i32, i32* %22
%24 = icmp slt i32 %23, 10
br i1 %24, label %25, label %30
25: ; preds = %20
%26 = load %struct.tm*, %struct.tm** %2
%27 = getelementptr inbounds %struct.tm, %struct.tm* %26, i32 0, i32 1
%28 = load i32, i32* %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %28)
br label %35
30: ; preds = %20
%31 = load %struct.tm*, %struct.tm** %2
%32 = getelementptr inbounds %struct.tm, %struct.tm* %31, i32 0, i32 1
%33 = load i32, i32* %32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 %33)
br label %35
35: ; preds = %30, %25
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32, i32 }
@.str.1 = [5 x i8] c"0%d:\00"
@.str.2 = [4 x i8] c"%d:\00"
@.str.3 = [7 x i8] c"0%d#> \00"
@.str.4 = [6 x i8] c"%d#> \00"
define void @show_prompt() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @time(i32* null)
store i32 %3, i32* %1
%4 = call %struct.tm* @localtime(i32* %1)
%5 = call i32 @putchar(i32 60)
%6 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%7 = load i32, i32* %6
%8 = icmp slt i32 %7, 10
%9 = select i1 %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %9, i32 %7)
%11 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 1
%12 = load i32, i32* %11
%13 = icmp slt i32 %12, 10
%14 = select i1 %13, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %14, i32 %12)
ret void
}