#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 *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ mktime(struct tm *);
time_t mklocaltime(struct tm *t) {
  time_t result;
  struct tm check = *t;
  check.tm_isdst = 0;
  result = mktime(&check);
  check = *localtime(&result);
  if (check.tm_isdst == 1) {
    check = *t;
    check.tm_isdst = 1;
    result = mktime(&check);
  }
  return result;
}


x86 assembly (clang, -O0):
<mklocaltime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
call   1040 <mktime@plt>
mov    %eax,-0xc(%rbp)
lea    -0xc(%rbp),%rdi
call   1030 <localtime@plt>
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
jne    117c <mklocaltime+0x5c>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
movl   $0x1,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
call   1040 <mktime@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mklocaltime>:
push   %rax
movl   $0x0,(%rsp)
mov    %rsp,%rdi
call   1040 <mktime@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <localtime@plt>
cmpl   $0x1,(%rax)
jne    1154 <mklocaltime+0x34>
movl   $0x1,(%rsp)
mov    %rsp,%rdi
call   1040 <mktime@plt>
pop    %rcx
ret
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
define i32 @mklocaltime(%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 = bitcast %struct.tm* %4 to i8*
%7 = bitcast %struct.tm* %5 to i8*
%8 = getelementptr inbounds %struct.tm, %struct.tm* %4, i32 0, i32 0
store i32 0, i32* %8
%9 = call i32 @mktime(%struct.tm* %4)
store i32 %9, i32* %3
%10 = call %struct.tm* @localtime(i32* %3)
%11 = bitcast %struct.tm* %4 to i8*
%12 = bitcast %struct.tm* %10 to i8*
%13 = getelementptr inbounds %struct.tm, %struct.tm* %4, i32 0, i32 0
%14 = load i32, i32* %13
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %22
16: ; preds = %1
%17 = load %struct.tm*, %struct.tm** %2
%18 = bitcast %struct.tm* %4 to i8*
%19 = bitcast %struct.tm* %17 to i8*
%20 = getelementptr inbounds %struct.tm, %struct.tm* %4, i32 0, i32 0
store i32 1, i32* %20
%21 = call i32 @mktime(%struct.tm* %4)
store i32 %21, i32* %3
br label %22
22: ; preds = %16, %1
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define i32 @mklocaltime(%struct.tm* nocapture readnone %0) {
%2 = alloca i32
%3 = alloca %struct.tm
%4 = bitcast i32* %2 to i8*
%5 = bitcast %struct.tm* %3 to i8*
%6 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 0
store i32 0, i32* %6
%7 = call i32 @mktime(%struct.tm* %3)
store i32 %7, i32* %2
%8 = call %struct.tm* @localtime(i32* %2)
%9 = getelementptr %struct.tm, %struct.tm* %8, i64 0, i32 0
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, 1
br i1 %11, label %14, label %12
12: ; preds = %1
%13 = load i32, i32* %2
br label %16
14: ; preds = %1
store i32 1, i32* %6
%15 = call i32 @mktime(%struct.tm* %3)
br label %16
16: ; preds = %12, %14
%17 = phi i32 [ %13, %12 ], [ %15, %14 ]
ret i32 %17
}