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

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
char *num2mon(int /*<<< orphan*/);
int /*<<< orphan*/ snprintf(char *, int, char *, int, char *, int, int, int,
                            int);
void thenp(char *b, time_t t) {
  struct tm *tms = localtime(&t);
  snprintf(b, 1024, "%02d/%s/%04d:%02d:%02d:%02d +0000", tms->tm_mday,
           num2mon(tms->tm_mon), tms->tm_year + 1900, tms->tm_hour, tms->tm_min,
           tms->tm_sec);
}


x86 assembly (clang, -O0):
<thenp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0xc(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    0x14(%rax),%edi
call   1050 <num2mon@plt>
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%ecx
mov    %rax,%r8
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%r9d
add    $0x76c,%r9d
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%r11d
mov    -0x18(%rbp),%rax
mov    0xc(%rax),%r10d
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%eax
mov    $0x400,%esi
lea    0xe5b(%rip),%rdx
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1040 <snprintf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thenp>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    %esi,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <localtime@plt>
mov    %rax,%rbx
mov    (%rax),%r15d
mov    0x14(%rax),%edi
call   1050 <num2mon@plt>
mov    $0x76c,%r9d
add    0x4(%rbx),%r9d
mov    0x8(%rbx),%r10d
mov    0xc(%rbx),%ebp
mov    0x10(%rbx),%ebx
sub    $0x8,%rsp
lea    0xe8b(%rip),%rdx
mov    %r14,%rdi
mov    $0x400,%esi
mov    %r15d,%ecx
mov    %rax,%r8
push   %rbx
push   %rbp
push   %r10
call   1040 <snprintf@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [34 x i8] c"%02d/%s/%04d:%02d:%02d:%02d +0000\00"
define void @thenp(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca %struct.tm*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = call %struct.tm* @localtime(i32* %4)
store %struct.tm* %6, %struct.tm** %5
%7 = load i8*, i8** %3
%8 = load %struct.tm*, %struct.tm** %5
%9 = getelementptr inbounds %struct.tm, %struct.tm* %8, i32 0, i32 0
%10 = load i32, i32* %9
%11 = load %struct.tm*, %struct.tm** %5
%12 = getelementptr inbounds %struct.tm, %struct.tm* %11, i32 0, i32 5
%13 = load i32, i32* %12
%14 = call i8* @num2mon(i32 %13)
%15 = load %struct.tm*, %struct.tm** %5
%16 = getelementptr inbounds %struct.tm, %struct.tm* %15, i32 0, i32 1
%17 = load i32, i32* %16
%18 = add nsw i32 %17, 1900
%19 = load %struct.tm*, %struct.tm** %5
%20 = getelementptr inbounds %struct.tm, %struct.tm* %19, i32 0, i32 2
%21 = load i32, i32* %20
%22 = load %struct.tm*, %struct.tm** %5
%23 = getelementptr inbounds %struct.tm, %struct.tm* %22, i32 0, i32 3
%24 = load i32, i32* %23
%25 = load %struct.tm*, %struct.tm** %5
%26 = getelementptr inbounds %struct.tm, %struct.tm* %25, i32 0, i32 4
%27 = load i32, i32* %26
%28 = call i32 @snprintf(i8* %7, i32 1024, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %10, i8* %14, i32 %18, i32 %21, i32 %24, i32 %27)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [34 x i8] c"%02d/%s/%04d:%02d:%02d:%02d +0000\00"
define void @thenp(i8* %0, i32 %1) {
%3 = alloca i32
store i32 %1, i32* %3
%4 = call %struct.tm* @localtime(i32* %3)
%5 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%6 = load i32, i32* %5
%7 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 5
%8 = load i32, i32* %7
%9 = call i8* @num2mon(i32 %8)
%10 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 1
%11 = load i32, i32* %10
%12 = add nsw i32 %11, 1900
%13 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 2
%14 = load i32, i32* %13
%15 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 3
%16 = load i32, i32* %15
%17 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 4
%18 = load i32, i32* %17
%19 = call i32 @snprintf(i8* %0, i32 1024, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %6, i8* %9, i32 %12, i32 %14, i32 %16, i32 %18)
ret void
}