#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 scalar_t__ time_t;
struct tm {
  int tm_year;
  int tm_mon;
  int tm_mday;
  int tm_hour;
  int tm_min;
  int tm_sec;
};

/* Variables and functions */
struct tm *gmtime(scalar_t__ *);
int /*<<< orphan*/ sprintf(char *, char *, int, int, int, int, int, int);
char *get_unixdate(double utime, char *date_str) {
  struct tm *gmt;
  time_t gmt_t;
  gmt_t = (time_t)utime;
  gmt = gmtime(&gmt_t);
  sprintf(date_str, "%.4d.%.2d.%.2d %.2d:%.2d:%.2d UTC", gmt->tm_year + 1900,
          gmt->tm_mon + 1, gmt->tm_mday, gmt->tm_hour, gmt->tm_min,
          gmt->tm_sec);
  return date_str;
}


x86 assembly (clang, -O0):
<get_unixdate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
cvttsd2si -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x20(%rbp),%rdi
call   1030 <gmtime@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
add    $0x76c,%edx
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%ecx
add    $0x1,%ecx
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%r8d
mov    -0x18(%rbp),%rax
mov    0xc(%rax),%r9d
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%r10d
mov    -0x18(%rbp),%rax
mov    0x14(%rax),%eax
lea    0xe78(%rip),%rsi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1040 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_unixdate>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
cvttsd2si %xmm0,%rax
mov    %rax,(%rsp)
mov    %rsp,%rdi
call   1030 <gmtime@plt>
mov    $0x76c,%edx
add    (%rax),%edx
mov    0x4(%rax),%ecx
mov    0x8(%rax),%r8d
add    $0x1,%ecx
mov    0xc(%rax),%r9d
mov    0x10(%rax),%ebx
mov    0x14(%rax),%eax
lea    0xea6(%rip),%rsi
mov    %r14,%rdi
push   %rax
push   %rbx
call   1040 <sprintf@plt>
add    $0x10,%rsp
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [34 x i8] c"%.4d.%.2d.%.2d %.2d:%.2d:%.2d UTC\00"
define i8* @get_unixdate(double %0, i8* %1) {
%3 = alloca double
%4 = alloca i8*
%5 = alloca %struct.tm*
%6 = alloca i64
store double %0, double* %3
store i8* %1, i8** %4
%7 = load double, double* %3
%8 = fptosi double %7 to i64
store i64 %8, i64* %6
%9 = call %struct.tm* @gmtime(i64* %6)
store %struct.tm* %9, %struct.tm** %5
%10 = load i8*, i8** %4
%11 = load %struct.tm*, %struct.tm** %5
%12 = getelementptr inbounds %struct.tm, %struct.tm* %11, i32 0, i32 0
%13 = load i32, i32* %12
%14 = add nsw i32 %13, 1900
%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, 1
%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 = load %struct.tm*, %struct.tm** %5
%29 = getelementptr inbounds %struct.tm, %struct.tm* %28, i32 0, i32 5
%30 = load i32, i32* %29
%31 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %18, i32 %21, i32 %24, i32 %27, i32 %30)
%32 = load i8*, i8** %4
ret i8* %32
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [34 x i8] c"%.4d.%.2d.%.2d %.2d:%.2d:%.2d UTC\00"
define i8* @get_unixdate(double %0, i8* returned writeonly %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to i8*
%5 = fptosi double %0 to i64
store i64 %5, i64* %3
%6 = call %struct.tm* @gmtime(i64* %3)
%7 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 0
%8 = load i32, i32* %7
%9 = add nsw i32 %8, 1900
%10 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 1
%11 = load i32, i32* %10
%12 = add nsw i32 %11, 1
%13 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 2
%14 = load i32, i32* %13
%15 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 3
%16 = load i32, i32* %15
%17 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 4
%18 = load i32, i32* %17
%19 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 5
%20 = load i32, i32* %19
%21 = call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %12, i32 %14, i32 %16, i32 %18, i32 %20)
ret i8* %1
}