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

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ snprintf(char *, int, char *, int, int, int,
                            int /*<<< orphan*/, int /*<<< orphan*/);
char *UNIX2ISO(time_t t) {
  struct tm *when;
  static char timestring[16];
  when = localtime(&t);
  when->tm_isdst = -1;
  snprintf(timestring, 15, "%i%02i%02i%02i%02i", when->tm_year + 1900,
           when->tm_mon + 1, when->tm_mday, when->tm_hour, when->tm_min);
  timestring[15] = '\0';
  return timestring;
}


x86 assembly (clang, -O0):
<UNIX2ISO>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0xffffffff,(%rax)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%ecx
add    $0x76c,%ecx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%r8d
add    $0x1,%r8d
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%r9d
mov    -0x10(%rbp),%rax
mov    0x14(%rax),%r10d
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%eax
lea    0x2ec7(%rip),%rdi
mov    $0xf,%esi
lea    0xe7b(%rip),%rdx
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1040 <snprintf@plt>
movb   $0x0,0x2eb6(%rip)
lea    0x2ea0(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UNIX2ISO>:
push   %r14
push   %rbx
push   %rax
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <localtime@plt>
movl   $0xffffffff,(%rax)
mov    $0x76c,%ecx
add    0x4(%rax),%ecx
mov    0x8(%rax),%r8d
mov    0xc(%rax),%r9d
add    $0x1,%r8d
mov    0x14(%rax),%ebx
mov    0x10(%rax),%eax
lea    0x2ee7(%rip),%r14
lea    0xea0(%rip),%rdx
mov    %r14,%rdi
mov    $0xf,%esi
push   %rax
push   %rbx
call   1040 <snprintf@plt>
add    $0x10,%rsp
movb   $0x0,0x2ed5(%rip)
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@UNIX2ISO.timestring = internal global [16 x i8] zeroinitializer
@.str = [19 x i8] c"%i%02i%02i%02i%02i\00"
define i8* @UNIX2ISO(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.tm*
store i32 %0, i32* %2
%4 = call %struct.tm* @localtime(i32* %2)
store %struct.tm* %4, %struct.tm** %3
%5 = load %struct.tm*, %struct.tm** %3
%6 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 0
store i32 -1, i32* %6
%7 = load %struct.tm*, %struct.tm** %3
%8 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 1
%9 = load i32, i32* %8
%10 = add nsw i32 %9, 1900
%11 = load %struct.tm*, %struct.tm** %3
%12 = getelementptr inbounds %struct.tm, %struct.tm* %11, i32 0, i32 2
%13 = load i32, i32* %12
%14 = add nsw i32 %13, 1
%15 = load %struct.tm*, %struct.tm** %3
%16 = getelementptr inbounds %struct.tm, %struct.tm* %15, i32 0, i32 3
%17 = load i32, i32* %16
%18 = load %struct.tm*, %struct.tm** %3
%19 = getelementptr inbounds %struct.tm, %struct.tm* %18, i32 0, i32 5
%20 = load i32, i32* %19
%21 = load %struct.tm*, %struct.tm** %3
%22 = getelementptr inbounds %struct.tm, %struct.tm* %21, i32 0, i32 4
%23 = load i32, i32* %22
%24 = call i32 @snprintf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @UNIX2ISO.timestring, i64 0, i64 0), i32 15, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %14, i32 %17, i32 %20, i32 %23)
store i8 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @UNIX2ISO.timestring, i64 0, i64 15)
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @UNIX2ISO.timestring, i64 0, i64 0)
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@UNIX2ISO.timestring = internal global [16 x i8] zeroinitializer
@.str = [19 x i8] c"%i%02i%02i%02i%02i\00"
define i8* @UNIX2ISO(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call %struct.tm* @localtime(i32* %2)
%4 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 0
store i32 -1, i32* %4
%5 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 1
%6 = load i32, i32* %5
%7 = add nsw i32 %6, 1900
%8 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 2
%9 = load i32, i32* %8
%10 = add nsw i32 %9, 1
%11 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 3
%12 = load i32, i32* %11
%13 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 5
%14 = load i32, i32* %13
%15 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 4
%16 = load i32, i32* %15
%17 = call i32 @snprintf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @UNIX2ISO.timestring, i64 0, i64 0), i32 15, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %10, i32 %12, i32 %14, i32 %16)
store i8 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @UNIX2ISO.timestring, i64 0, i64 15)
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @UNIX2ISO.timestring, i64 0, i64 0)
}