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

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ set_clock(int, scalar_t__, scalar_t__, int /*<<< orphan*/,
                             int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void set_clock_to_now(int f) {
  time_t tt;
  struct tm *t;
  tt = time(NULL);
  t = localtime(&tt);
  if (t != NULL) {
    set_clock(f, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour,
              t->tm_min);
  }
}


x86 assembly (clang, -O0):
<set_clock_to_now>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1198 <set_clock_to_now+0x68>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
add    $0x76c,%rsi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
add    $0x1,%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%r8d
mov    -0x10(%rbp),%rax
mov    (%rax),%r9d
call   1050 <set_clock@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_clock_to_now>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
test   %rax,%rax
je     1173 <set_clock_to_now+0x43>
mov    $0x76c,%esi
add    0x18(%rax),%rsi
mov    0x10(%rax),%rdx
add    $0x1,%rdx
mov    0x8(%rax),%ecx
mov    (%rax),%r9d
mov    0x4(%rax),%r8d
mov    %ebx,%edi
call   1050 <set_clock@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i64, i64 }
define void @set_clock_to_now(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.tm*
store i32 %0, i32* %2
%5 = call i32 @time(i32* null)
store i32 %5, i32* %3
%6 = call %struct.tm* @localtime(i32* %3)
store %struct.tm* %6, %struct.tm** %4
%7 = load %struct.tm*, %struct.tm** %4
%8 = icmp ne %struct.tm* %7, null
br i1 %8, label %9, label %29
9: ; preds = %1
%10 = load i32, i32* %2
%11 = load %struct.tm*, %struct.tm** %4
%12 = getelementptr inbounds %struct.tm, %struct.tm* %11, i32 0, i32 4
%13 = load i64, i64* %12
%14 = add nsw i64 %13, 1900
%15 = load %struct.tm*, %struct.tm** %4
%16 = getelementptr inbounds %struct.tm, %struct.tm* %15, i32 0, i32 3
%17 = load i64, i64* %16
%18 = add nsw i64 %17, 1
%19 = load %struct.tm*, %struct.tm** %4
%20 = getelementptr inbounds %struct.tm, %struct.tm* %19, i32 0, i32 2
%21 = load i32, i32* %20
%22 = load %struct.tm*, %struct.tm** %4
%23 = getelementptr inbounds %struct.tm, %struct.tm* %22, i32 0, i32 1
%24 = load i32, i32* %23
%25 = load %struct.tm*, %struct.tm** %4
%26 = getelementptr inbounds %struct.tm, %struct.tm* %25, i32 0, i32 0
%27 = load i32, i32* %26
%28 = call i32 @set_clock(i32 %10, i64 %14, i64 %18, i32 %21, i32 %24, i32 %27)
br label %29
29: ; preds = %9, %1
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i64, i64 }
define void @set_clock_to_now(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 @time(i32* null)
store i32 %4, i32* %2
%5 = call %struct.tm* @localtime(i32* %2)
%6 = icmp eq %struct.tm* %5, null
br i1 %6, label %21, label %7
7: ; preds = %1
%8 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 4
%9 = load i64, i64* %8
%10 = add nsw i64 %9, 1900
%11 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 3
%12 = load i64, i64* %11
%13 = add nsw i64 %12, 1
%14 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 2
%15 = load i32, i32* %14
%16 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 1
%17 = load i32, i32* %16
%18 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 0
%19 = load i32, i32* %18
%20 = call i32 @set_clock(i32 %0, i64 %10, i64 %13, i32 %15, i32 %17, i32 %19)
br label %21
21: ; preds = %7, %1
ret void
}