#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 tm_hour;
  int tm_min;
  int tm_sec;
};
struct timeval {
  int /*<<< orphan*/ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/);
struct tm *localtime(int /*<<< orphan*/ *);
void get_time(int *hour, int *min, int *sec) {
  struct timeval tv;
  struct tm *localTime = NULL;
  time_t actualTime;
  gettimeofday(&tv, 0);
  actualTime = tv.tv_sec;
  localTime = localtime(&actualTime);
  if (hour)
    *hour = localTime->tm_hour;
  if (min)
    *min = localTime->tm_min;
  if (sec)
    *sec = localTime->tm_sec;
}


x86 assembly (clang, -O0):
<get_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x28(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
call   1040 <gettimeofday@plt>
mov    -0x20(%rbp),%eax
mov    %eax,-0x2c(%rbp)
lea    -0x2c(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1171 <get_time+0x51>
mov    -0x28(%rbp),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
cmpq   $0x0,-0x10(%rbp)
je     1189 <get_time+0x69>
mov    -0x28(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     11a1 <get_time+0x81>
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_time>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1040 <gettimeofday@plt>
mov    0x8(%rsp),%eax
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
test   %rbx,%rbx
je     1159 <get_time+0x39>
mov    (%rax),%ecx
mov    %ecx,(%rbx)
test   %r15,%r15
je     1164 <get_time+0x44>
mov    0x4(%rax),%ecx
mov    %ecx,(%r15)
test   %r14,%r14
je     116f <get_time+0x4f>
mov    0x8(%rax),%eax
mov    %eax,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
%struct.tm = type { i32, i32, i32 }
define void @get_time(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca %struct.timeval
%8 = alloca %struct.tm*
%9 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
store %struct.tm* null, %struct.tm** %8
%10 = call i32 @gettimeofday(%struct.timeval* %7, i32 0)
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 0
%12 = load i32, i32* %11
store i32 %12, i32* %9
%13 = call %struct.tm* @localtime(i32* %9)
store %struct.tm* %13, %struct.tm** %8
%14 = load i32*, i32** %4
%15 = icmp ne i32* %14, null
br i1 %15, label %16, label %21
16: ; preds = %3
%17 = load %struct.tm*, %struct.tm** %8
%18 = getelementptr inbounds %struct.tm, %struct.tm* %17, i32 0, i32 0
%19 = load i32, i32* %18
%20 = load i32*, i32** %4
store i32 %19, i32* %20
br label %21
21: ; preds = %16, %3
%22 = load i32*, i32** %5
%23 = icmp ne i32* %22, null
br i1 %23, label %24, label %29
24: ; preds = %21
%25 = load %struct.tm*, %struct.tm** %8
%26 = getelementptr inbounds %struct.tm, %struct.tm* %25, i32 0, i32 1
%27 = load i32, i32* %26
%28 = load i32*, i32** %5
store i32 %27, i32* %28
br label %29
29: ; preds = %24, %21
%30 = load i32*, i32** %6
%31 = icmp ne i32* %30, null
br i1 %31, label %32, label %37
32: ; preds = %29
%33 = load %struct.tm*, %struct.tm** %8
%34 = getelementptr inbounds %struct.tm, %struct.tm* %33, i32 0, i32 2
%35 = load i32, i32* %34
%36 = load i32*, i32** %6
store i32 %35, i32* %36
br label %37
37: ; preds = %32, %29
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
%struct.tm = type { i32, i32, i32 }
define void @get_time(i32* writeonly %0, i32* writeonly %1, i32* writeonly %2) {
%4 = alloca %struct.timeval
%5 = alloca i32
%6 = bitcast %struct.timeval* %4 to i8*
%7 = bitcast i32* %5 to i8*
%8 = call i32 @gettimeofday(%struct.timeval* %4, i32 0)
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 0
%10 = load i32, i32* %9
store i32 %10, i32* %5
%11 = call %struct.tm* @localtime(i32* %5)
%12 = icmp eq i32* %0, null
br i1 %12, label %16, label %13
13: ; preds = %3
%14 = getelementptr inbounds %struct.tm, %struct.tm* %11, i64 0, i32 0
%15 = load i32, i32* %14
store i32 %15, i32* %0
br label %16
16: ; preds = %13, %3
%17 = icmp eq i32* %1, null
br i1 %17, label %21, label %18
18: ; preds = %16
%19 = getelementptr inbounds %struct.tm, %struct.tm* %11, i64 0, i32 1
%20 = load i32, i32* %19
store i32 %20, i32* %1
br label %21
21: ; preds = %18, %16
%22 = icmp eq i32* %2, null
br i1 %22, label %26, label %23
23: ; preds = %21
%24 = getelementptr inbounds %struct.tm, %struct.tm* %11, i64 0, i32 2
%25 = load i32, i32* %24
store i32 %25, i32* %2
br label %26
26: ; preds = %23, %21
ret void
}