#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_isdst;
};

/* Variables and functions */
struct tm *gmtime(int /*<<< orphan*/ *);
struct tm *localtime(int /*<<< orphan*/ *);
int mktime(struct tm *);
void get_time_diff(time_t t, int *timediff, int *is_dst) {
  struct tm tm_utc, tm_local;
  tm_utc = *(gmtime(&t));
  tm_local = *(localtime(&t));
  *timediff = mktime(&tm_utc) - mktime(&tm_local);
  *is_dst = tm_local.tm_isdst;
}


x86 assembly (clang, -O0):
<get_time_diff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x4(%rbp),%rdi
call   1050 <gmtime@plt>
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
lea    -0x20(%rbp),%rdi
call   1040 <mktime@plt>
mov    %eax,-0x2c(%rbp)
lea    -0x28(%rbp),%rdi
call   1040 <mktime@plt>
mov    -0x2c(%rbp),%ecx
sub    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_time_diff>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %edi,0xc(%rsp)
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <gmtime@plt>
mov    (%rax),%eax
mov    %eax,0x8(%rsp)
mov    %rbx,%rdi
call   1030 <localtime@plt>
mov    (%rax),%eax
mov    %eax,(%rsp)
lea    0x8(%rsp),%rdi
call   1040 <mktime@plt>
mov    %eax,%ebx
mov    %rsp,%rdi
call   1040 <mktime@plt>
sub    %eax,%ebx
mov    %ebx,(%r15)
mov    (%rsp),%eax
mov    %eax,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
define void @get_time_diff(i32 %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca %struct.tm
%8 = alloca %struct.tm
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%9 = call %struct.tm* @gmtime(i32* %4)
%10 = bitcast %struct.tm* %7 to i8*
%11 = bitcast %struct.tm* %9 to i8*
%12 = call %struct.tm* @localtime(i32* %4)
%13 = bitcast %struct.tm* %8 to i8*
%14 = bitcast %struct.tm* %12 to i8*
%15 = call i32 @mktime(%struct.tm* %7)
%16 = call i32 @mktime(%struct.tm* %8)
%17 = sub nsw i32 %15, %16
%18 = load i32*, i32** %5
store i32 %17, i32* %18
%19 = getelementptr inbounds %struct.tm, %struct.tm* %8, i32 0, i32 0
%20 = load i32, i32* %19
%21 = load i32*, i32** %6
store i32 %20, i32* %21
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define void @get_time_diff(i32 %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = alloca i32
%5 = alloca %struct.tm
%6 = alloca %struct.tm
store i32 %0, i32* %4
%7 = bitcast %struct.tm* %5 to i8*
%8 = bitcast %struct.tm* %6 to i8*
%9 = call %struct.tm* @gmtime(i32* %4)
%10 = getelementptr %struct.tm, %struct.tm* %9, i64 0, i32 0
%11 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 0
%12 = load i32, i32* %10
store i32 %12, i32* %11
%13 = call %struct.tm* @localtime(i32* %4)
%14 = getelementptr %struct.tm, %struct.tm* %13, i64 0, i32 0
%15 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 0
%16 = load i32, i32* %14
store i32 %16, i32* %15
%17 = call i32 @mktime(%struct.tm* %5)
%18 = call i32 @mktime(%struct.tm* %6)
%19 = sub nsw i32 %17, %18
store i32 %19, i32* %1
%20 = load i32, i32* %15
store i32 %20, i32* %2
ret void
}