#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 uint16_t;
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
char *_mk_header(char *s, uint16_t page, time_t timestamp) {
  char temp[33];
  struct tm *tm;
  tm = localtime(&timestamp);
  snprintf(temp, 33,
           "hacktv   %03X %%a %%d %%b\x03"
           "%%H:%%M/%%S",
           page);
  strftime(s, 33, temp, tm);
  return (s);
}


x86 assembly (clang, -O0):
<_mk_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x48(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0xc(%rbp),%ecx
mov    $0x21,%esi
lea    0xe9e(%rip),%rdx
call   1040 <snprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x40(%rbp),%rdx
mov    -0x48(%rbp),%rcx
mov    $0x21,%esi
call   1050 <strftime@plt>
mov    -0x8(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_mk_header>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    %esi,%r14d
mov    %rdi,%rbx
mov    %edx,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
mov    %rax,%rbp
lea    0xea8(%rip),%rdx
lea    0x10(%rsp),%r15
mov    %r15,%rdi
mov    $0x21,%esi
mov    %r14d,%ecx
call   1040 <snprintf@plt>
mov    %rbx,%rdi
mov    $0x21,%esi
mov    %r15,%rdx
mov    %rbp,%rcx
call   1050 <strftime@plt>
mov    %rbx,%rax
add    $0x38,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [38 x i8] c"hacktv %03X %%a %%d %%b\03%%H:%%M/%%S\00"
define i8* @_mk_header(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [33 x i8]
%8 = alloca %struct.tm*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = call %struct.tm* @localtime(i32* %6)
store %struct.tm* %9, %struct.tm** %8
%10 = getelementptr inbounds [33 x i8], [33 x i8]* %7, i64 0, i64 0
%11 = load i32, i32* %5
%12 = call i32 @snprintf(i8* %10, i32 33, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load i8*, i8** %4
%14 = getelementptr inbounds [33 x i8], [33 x i8]* %7, i64 0, i64 0
%15 = load %struct.tm*, %struct.tm** %8
%16 = call i32 @strftime(i8* %13, i32 33, i8* %14, %struct.tm* %15)
%17 = load i8*, i8** %4
ret i8* %17
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [38 x i8] c"hacktv %03X %%a %%d %%b\03%%H:%%M/%%S\00"
define i8* @_mk_header(i8* returned %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca [33 x i8]
store i32 %2, i32* %4
%6 = getelementptr inbounds [33 x i8], [33 x i8]* %5, i64 0, i64 0
%7 = call %struct.tm* @localtime(i32* %4)
%8 = call i32 @snprintf(i8* %6, i32 33, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %1)
%9 = call i32 @strftime(i8* %0, i32 33, i8* %6, %struct.tm* %7)
ret i8* %0
}