#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 */
struct tm {
  int tm_year;
  int tm_mon;
  int tm_mday;
  int tm_hour;
  int tm_min;
  int tm_sec;
  int tm_wday;
  int tm_yday;
  int tm_isdst;
  char *tm_zone;
  int /*<<< orphan*/ tm_gmtoff;
};

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int, int, int, int, int, int, int,
                           int, int, char *, int /*<<< orphan*/);
void display_tm(char *buffer, struct tm t) {
  sprintf(buffer,
          "%04d-%02d-%02d  %02d:%02d:%02d  dw:%d  dy:%d/365  dst=%d  tz=%s  "
          "off=%lds",
          t.tm_year + 1900, t.tm_mon + 1, t.tm_mday, t.tm_hour, t.tm_min,
          t.tm_sec, t.tm_wday, t.tm_yday, t.tm_isdst, t.tm_zone, t.tm_gmtoff);
}


x86 assembly (clang, -O0):
<display_tm>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x40,%rsp
lea    0x10(%rbp),%rax
mov    %rdi,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    (%rax),%edx
add    $0x76c,%edx
mov    0x4(%rax),%ecx
add    $0x1,%ecx
mov    0x8(%rax),%r8d
mov    0xc(%rax),%r9d
mov    0x10(%rax),%r12d
mov    0x14(%rax),%r15d
mov    0x18(%rax),%r14d
mov    0x1c(%rax),%ebx
mov    0x20(%rax),%r11d
mov    0x28(%rax),%r10
mov    0x30(%rax),%eax
lea    0xe9e(%rip),%rsi
mov    %r12d,(%rsp)
mov    %r15d,0x8(%rsp)
mov    %r14d,0x10(%rsp)
mov    %ebx,0x18(%rsp)
mov    %r11d,0x20(%rsp)
mov    %r10,0x28(%rsp)
mov    %eax,0x30(%rsp)
call   1030 <sprintf@plt>
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_tm>:
push   %r15
push   %r14
push   %rbx
mov    $0x76c,%edx
add    0x20(%rsp),%edx
mov    0x24(%rsp),%ecx
mov    0x28(%rsp),%r8d
add    $0x1,%ecx
mov    0x2c(%rsp),%r9d
mov    0x30(%rsp),%r10d
mov    0x34(%rsp),%r11d
mov    0x38(%rsp),%r14d
mov    0x3c(%rsp),%r15d
mov    0x40(%rsp),%eax
mov    0x50(%rsp),%ebx
sub    $0x8,%rsp
lea    0xeaa(%rip),%rsi
push   %rbx
push   0x58(%rsp)
push   %rax
push   %r15
push   %r14
push   %r11
push   %r10
call   1030 <sprintf@plt>
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i8*, i32 }
@.str = [74 x i8] c"%04d-%02d-%02d %02d:%02d:%02d dw:%d dy:%d/365 dst=%d tz=%s off=%lds\00"
define void @display_tm(i8* %0, %struct.tm* byval(%struct.tm) align 8 %1) {
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 0
%6 = load i32, i32* %5
%7 = add nsw i32 %6, 1900
%8 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 1
%9 = load i32, i32* %8
%10 = add nsw i32 %9, 1
%11 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 2
%12 = load i32, i32* %11
%13 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 3
%14 = load i32, i32* %13
%15 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 4
%16 = load i32, i32* %15
%17 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 5
%18 = load i32, i32* %17
%19 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 6
%20 = load i32, i32* %19
%21 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 7
%22 = load i32, i32* %21
%23 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 8
%24 = load i32, i32* %23
%25 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 9
%26 = load i8*, i8** %25
%27 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 10
%28 = load i32, i32* %27
%29 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %10, i32 %12, i32 %14, i32 %16, i32 %18, i32 %20, i32 %22, i32 %24, i8* %26, i32 %28)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i8*, i32 }
@.str = [74 x i8] c"%04d-%02d-%02d %02d:%02d:%02d dw:%d dy:%d/365 dst=%d tz=%s off=%lds\00"
define void @display_tm(i8* nocapture writeonly %0, %struct.tm* nocapture byval(%struct.tm) align 8 %1) {
%3 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 0
%4 = load i32, i32* %3
%5 = add nsw i32 %4, 1900
%6 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 1
%7 = load i32, i32* %6
%8 = add nsw i32 %7, 1
%9 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 2
%10 = load i32, i32* %9
%11 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 3
%12 = load i32, i32* %11
%13 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 4
%14 = load i32, i32* %13
%15 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 5
%16 = load i32, i32* %15
%17 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 6
%18 = load i32, i32* %17
%19 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 7
%20 = load i32, i32* %19
%21 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 8
%22 = load i32, i32* %21
%23 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 9
%24 = load i8*, i8** %23
%25 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 10
%26 = load i32, i32* %25
%27 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %8, i32 %10, i32 %12, i32 %14, i32 %16, i32 %18, i32 %20, i32 %22, i8* %24, i32 %26)
ret void
}