#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_sec;
  int tm_min;
  int tm_hour;
  int tm_mday;
  int tm_mon;
  int tm_year;
};

/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ sprintf(char *, char *, int, int, int, int, int, int);
char *dump_date(const struct tm *date) {
  char *dump = malloc(80 * sizeof(char));
  sprintf(dump, "{ %d, %d, %d, %d, %d, %d }", date->tm_sec, date->tm_min,
          date->tm_hour, date->tm_mday, date->tm_mon, date->tm_year);
  return dump;
}


x86 assembly (clang, -O0):
<dump_date>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x50,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%r8d
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%r9d
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%r10d
mov    -0x8(%rbp),%rax
mov    0x14(%rax),%eax
lea    0xe8f(%rip),%rsi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1040 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_date>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x50,%edi
call   1030 <malloc@plt>
mov    %rax,%r14
mov    (%rbx),%edx
mov    0x4(%rbx),%ecx
mov    0x8(%rbx),%r8d
mov    0xc(%rbx),%r9d
mov    0x10(%rbx),%eax
mov    0x14(%rbx),%ebx
lea    0xeb2(%rip),%rsi
mov    %r14,%rdi
push   %rbx
push   %rax
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 = [27 x i8] c"{ %d, %d, %d, %d, %d, %d }\00"
define i8* @dump_date(%struct.tm* %0) {
%2 = alloca %struct.tm*
%3 = alloca i8*
store %struct.tm* %0, %struct.tm** %2
%4 = call i8* @malloc(i32 80)
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = load %struct.tm*, %struct.tm** %2
%7 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 0
%8 = load i32, i32* %7
%9 = load %struct.tm*, %struct.tm** %2
%10 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 1
%11 = load i32, i32* %10
%12 = load %struct.tm*, %struct.tm** %2
%13 = getelementptr inbounds %struct.tm, %struct.tm* %12, i32 0, i32 2
%14 = load i32, i32* %13
%15 = load %struct.tm*, %struct.tm** %2
%16 = getelementptr inbounds %struct.tm, %struct.tm* %15, i32 0, i32 3
%17 = load i32, i32* %16
%18 = load %struct.tm*, %struct.tm** %2
%19 = getelementptr inbounds %struct.tm, %struct.tm* %18, i32 0, i32 4
%20 = load i32, i32* %19
%21 = load %struct.tm*, %struct.tm** %2
%22 = getelementptr inbounds %struct.tm, %struct.tm* %21, i32 0, i32 5
%23 = load i32, i32* %22
%24 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %11, i32 %14, i32 %17, i32 %20, i32 %23)
%25 = load i8*, i8** %3
ret i8* %25
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [27 x i8] c"{ %d, %d, %d, %d, %d, %d }\00"
define noalias i8* @dump_date(%struct.tm* nocapture %0) {
%2 = tail call dereferenceable_or_null(80) i8* @malloc(i32 80)
%3 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 0
%4 = load i32, i32* %3
%5 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 1
%6 = load i32, i32* %5
%7 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 2
%8 = load i32, i32* %7
%9 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 3
%10 = load i32, i32* %9
%11 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 4
%12 = load i32, i32* %11
%13 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 5
%14 = load i32, i32* %13
%15 = tail call i32 @sprintf(i8* dereferenceable(1) %2, i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %6, i32 %8, i32 %10, i32 %12, i32 %14)
ret i8* %2
}