#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 /*<<< orphan*/ tm_hour;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int /*<<< orphan*/ timeToDoSomething(int /*<<< orphan*/);
void getTime(int size, char format[], time_t timeInit, struct tm date) {
  time(&timeInit);
  date = *localtime(&timeInit);
  strftime(format, size, "We're %A the %d %B %Y and it's %X.\n", &date);
  timeToDoSomething(date.tm_hour);
}


x86 assembly (clang, -O0):
<getTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %ecx,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
lea    -0x1c(%rbp),%rdi
call   1050 <time@plt>
lea    -0x1c(%rbp),%rdi
call   1030 <localtime@plt>
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    0xe86(%rip),%rdx
lea    -0x8(%rbp),%rcx
call   1060 <strftime@plt>
mov    -0x8(%rbp),%edi
call   1040 <timeToDoSomething@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getTime>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %edi,%ebp
mov    %edx,0xc(%rsp)
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
mov    (%rax),%eax
mov    %eax,0x8(%rsp)
lea    0xe8d(%rip),%rdx
lea    0x8(%rsp),%rcx
mov    %r14,%rdi
mov    %ebp,%esi
call   1060 <strftime@plt>
mov    0x8(%rsp),%edi
call   1040 <timeToDoSomething@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [36 x i8] c"We're %A the %d %B %Y and it's %X.\0A\00"
define void @getTime(i32 %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca %struct.tm
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 0
store i32 %3, i32* %9
store i32 %0, i32* %6
store i8* %1, i8** %7
store i32 %2, i32* %8
%10 = call i32 @time(i32* %8)
%11 = call %struct.tm* @localtime(i32* %8)
%12 = bitcast %struct.tm* %5 to i8*
%13 = bitcast %struct.tm* %11 to i8*
%14 = load i8*, i8** %7
%15 = load i32, i32* %6
%16 = call i32 @strftime(i8* %14, i32 %15, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), %struct.tm* %5)
%17 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 0
%18 = load i32, i32* %17
%19 = call i32 @timeToDoSomething(i32 %18)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [36 x i8] c"We're %A the %d %B %Y and it's %X.\0A\00"
define void @getTime(i32 %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca %struct.tm
%6 = alloca i32
%7 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 0
store i32 %2, i32* %6
%8 = call i32 @time(i32* %6)
%9 = call %struct.tm* @localtime(i32* %6)
%10 = getelementptr %struct.tm, %struct.tm* %9, i64 0, i32 0
%11 = load i32, i32* %10
store i32 %11, i32* %7
%12 = call i32 @strftime(i8* %1, i32 %0, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), %struct.tm* %5)
%13 = load i32, i32* %7
%14 = call i32 @timeToDoSomething(i32 %13)
ret void
}