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

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ mktime(struct tm *);
void normaliseTm(struct tm *t) {
  time_t ts = mktime(t);
  struct tm *tm = localtime(&ts);
  t->tm_year = tm->tm_year;
  t->tm_mon = tm->tm_mon;
  t->tm_mday = tm->tm_mday;
  t->tm_hour = tm->tm_hour;
}


x86 assembly (clang, -O0):
<normaliseTm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <mktime@plt>
mov    %eax,-0xc(%rbp)
lea    -0xc(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    0xc(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<normaliseTm>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
call   1040 <mktime@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
movups (%rax),%xmm0
movups %xmm0,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32 }
define void @normaliseTm(%struct.tm* %0) {
%2 = alloca %struct.tm*
%3 = alloca i32
%4 = alloca %struct.tm*
store %struct.tm* %0, %struct.tm** %2
%5 = load %struct.tm*, %struct.tm** %2
%6 = call i32 @mktime(%struct.tm* %5)
store i32 %6, i32* %3
%7 = call %struct.tm* @localtime(i32* %3)
store %struct.tm* %7, %struct.tm** %4
%8 = load %struct.tm*, %struct.tm** %4
%9 = getelementptr inbounds %struct.tm, %struct.tm* %8, i32 0, i32 3
%10 = load i32, i32* %9
%11 = load %struct.tm*, %struct.tm** %2
%12 = getelementptr inbounds %struct.tm, %struct.tm* %11, i32 0, i32 3
store i32 %10, i32* %12
%13 = load %struct.tm*, %struct.tm** %4
%14 = getelementptr inbounds %struct.tm, %struct.tm* %13, i32 0, i32 2
%15 = load i32, i32* %14
%16 = load %struct.tm*, %struct.tm** %2
%17 = getelementptr inbounds %struct.tm, %struct.tm* %16, i32 0, i32 2
store i32 %15, i32* %17
%18 = load %struct.tm*, %struct.tm** %4
%19 = getelementptr inbounds %struct.tm, %struct.tm* %18, i32 0, i32 1
%20 = load i32, i32* %19
%21 = load %struct.tm*, %struct.tm** %2
%22 = getelementptr inbounds %struct.tm, %struct.tm* %21, i32 0, i32 1
store i32 %20, i32* %22
%23 = load %struct.tm*, %struct.tm** %4
%24 = getelementptr inbounds %struct.tm, %struct.tm* %23, i32 0, i32 0
%25 = load i32, i32* %24
%26 = load %struct.tm*, %struct.tm** %2
%27 = getelementptr inbounds %struct.tm, %struct.tm* %26, i32 0, i32 0
store i32 %25, i32* %27
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32 }
define void @normaliseTm(%struct.tm* nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 @mktime(%struct.tm* %0)
store i32 %4, i32* %2
%5 = call %struct.tm* @localtime(i32* %2)
%6 = bitcast %struct.tm* %5 to <4 x i32>*
%7 = load <4 x i32>, <4 x i32>* %6
%8 = bitcast %struct.tm* %0 to <4 x i32>*
store <4 x i32> %7, <4 x i32>* %8
ret void
}