#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 {
  scalar_t__ tm_sec;
  scalar_t__ tm_min;
  scalar_t__ tm_hour;
  scalar_t__ tm_mday;
  scalar_t__ tm_mon;
  scalar_t__ tm_year;
};

/* Variables and functions */
struct tm *gmtime(int /*<<< orphan*/ *);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ mktime(struct tm *);
time_t make_time_from_utc(struct tm *tm) {
  struct tm local, *utc;
  time_t t;
  t = mktime(tm);
  local = *localtime(&t);
  utc = gmtime(&t);
  local.tm_year += local.tm_year - utc->tm_year;
  local.tm_mon += local.tm_mon - utc->tm_mon;
  local.tm_mday += local.tm_mday - utc->tm_mday;
  local.tm_hour += local.tm_hour - utc->tm_hour;
  local.tm_min += local.tm_min - utc->tm_min;
  local.tm_sec += local.tm_sec - utc->tm_sec;
  return mktime(&local);
}


x86 assembly (clang, -O0):
<make_time_from_utc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <mktime@plt>
mov    %eax,-0x44(%rbp)
lea    -0x44(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,%rsi
lea    -0x38(%rbp),%rdi
mov    $0x30,%edx
call   1040 <memcpy@plt>
lea    -0x44(%rbp),%rdi
call   1060 <gmtime@plt>
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    0x28(%rcx),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    0x20(%rcx),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    0x18(%rcx),%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    0x10(%rcx),%rax
add    -0x28(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x30(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    0x8(%rcx),%rax
add    -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x38(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    (%rcx),%rax
add    -0x38(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x38(%rbp),%rdi
call   1050 <mktime@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_time_from_utc>:
push   %rbx
sub    $0x40,%rsp
call   1040 <mktime@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <localtime@plt>
movups (%rax),%xmm0
movups 0x10(%rax),%xmm1
movups 0x20(%rax),%xmm2
movaps %xmm0,0x10(%rsp)
movaps %xmm1,0x20(%rsp)
movaps %xmm2,0x30(%rsp)
mov    %rbx,%rdi
call   1050 <gmtime@plt>
movdqa 0x10(%rsp),%xmm0
movdqa 0x20(%rsp),%xmm1
movdqa 0x30(%rsp),%xmm2
movdqu 0x20(%rax),%xmm3
paddq  %xmm2,%xmm2
psubq  %xmm3,%xmm2
movdqa %xmm2,0x30(%rsp)
movdqu 0x10(%rax),%xmm2
paddq  %xmm1,%xmm1
psubq  %xmm2,%xmm1
movdqa %xmm1,0x20(%rsp)
movdqu (%rax),%xmm1
paddq  %xmm0,%xmm0
psubq  %xmm1,%xmm0
movdqa %xmm0,0x10(%rsp)
lea    0x10(%rsp),%rdi
call   1040 <mktime@plt>
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i64, i64, i64, i64, i64, i64 }
define i32 @make_time_from_utc(%struct.tm* %0) {
%2 = alloca %struct.tm*
%3 = alloca %struct.tm
%4 = alloca %struct.tm*
%5 = alloca i32
store %struct.tm* %0, %struct.tm** %2
%6 = load %struct.tm*, %struct.tm** %2
%7 = call i32 @mktime(%struct.tm* %6)
store i32 %7, i32* %5
%8 = call %struct.tm* @localtime(i32* %5)
%9 = bitcast %struct.tm* %3 to i8*
%10 = bitcast %struct.tm* %8 to i8*
%11 = call %struct.tm* @gmtime(i32* %5)
store %struct.tm* %11, %struct.tm** %4
%12 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 5
%13 = load i64, i64* %12
%14 = load %struct.tm*, %struct.tm** %4
%15 = getelementptr inbounds %struct.tm, %struct.tm* %14, i32 0, i32 5
%16 = load i64, i64* %15
%17 = sub nsw i64 %13, %16
%18 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 5
%19 = load i64, i64* %18
%20 = add nsw i64 %19, %17
store i64 %20, i64* %18
%21 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 4
%22 = load i64, i64* %21
%23 = load %struct.tm*, %struct.tm** %4
%24 = getelementptr inbounds %struct.tm, %struct.tm* %23, i32 0, i32 4
%25 = load i64, i64* %24
%26 = sub nsw i64 %22, %25
%27 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 4
%28 = load i64, i64* %27
%29 = add nsw i64 %28, %26
store i64 %29, i64* %27
%30 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 3
%31 = load i64, i64* %30
%32 = load %struct.tm*, %struct.tm** %4
%33 = getelementptr inbounds %struct.tm, %struct.tm* %32, i32 0, i32 3
%34 = load i64, i64* %33
%35 = sub nsw i64 %31, %34
%36 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 3
%37 = load i64, i64* %36
%38 = add nsw i64 %37, %35
store i64 %38, i64* %36
%39 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 2
%40 = load i64, i64* %39
%41 = load %struct.tm*, %struct.tm** %4
%42 = getelementptr inbounds %struct.tm, %struct.tm* %41, i32 0, i32 2
%43 = load i64, i64* %42
%44 = sub nsw i64 %40, %43
%45 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 2
%46 = load i64, i64* %45
%47 = add nsw i64 %46, %44
store i64 %47, i64* %45
%48 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 1
%49 = load i64, i64* %48
%50 = load %struct.tm*, %struct.tm** %4
%51 = getelementptr inbounds %struct.tm, %struct.tm* %50, i32 0, i32 1
%52 = load i64, i64* %51
%53 = sub nsw i64 %49, %52
%54 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 1
%55 = load i64, i64* %54
%56 = add nsw i64 %55, %53
store i64 %56, i64* %54
%57 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 0
%58 = load i64, i64* %57
%59 = load %struct.tm*, %struct.tm** %4
%60 = getelementptr inbounds %struct.tm, %struct.tm* %59, i32 0, i32 0
%61 = load i64, i64* %60
%62 = sub nsw i64 %58, %61
%63 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 0
%64 = load i64, i64* %63
%65 = add nsw i64 %64, %62
store i64 %65, i64* %63
%66 = call i32 @mktime(%struct.tm* %3)
ret i32 %66
}

LLVM IR (-O2):
%struct.tm = type { i64, i64, i64, i64, i64, i64 }
define i32 @make_time_from_utc(%struct.tm* nocapture %0) {
%2 = alloca %struct.tm
%3 = alloca i32
%4 = bitcast %struct.tm* %2 to i8*
%5 = bitcast i32* %3 to i8*
%6 = tail call i32 @mktime(%struct.tm* %0)
store i32 %6, i32* %3
%7 = call %struct.tm* @localtime(i32* %3)
%8 = bitcast %struct.tm* %7 to i8*
%9 = call %struct.tm* @gmtime(i32* %3)
%10 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 4
%11 = bitcast i64* %10 to <2 x i64>*
%12 = load <2 x i64>, <2 x i64>* %11
%13 = getelementptr inbounds %struct.tm, %struct.tm* %9, i64 0, i32 4
%14 = bitcast i64* %13 to <2 x i64>*
%15 = load <2 x i64>, <2 x i64>* %14
%16 = shl <2 x i64> %12, <i64 1, i64 1>
%17 = sub <2 x i64> %16, %15
%18 = bitcast i64* %10 to <2 x i64>*
store <2 x i64> %17, <2 x i64>* %18
%19 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 2
%20 = bitcast i64* %19 to <2 x i64>*
%21 = load <2 x i64>, <2 x i64>* %20
%22 = getelementptr inbounds %struct.tm, %struct.tm* %9, i64 0, i32 2
%23 = bitcast i64* %22 to <2 x i64>*
%24 = load <2 x i64>, <2 x i64>* %23
%25 = shl <2 x i64> %21, <i64 1, i64 1>
%26 = sub <2 x i64> %25, %24
%27 = bitcast i64* %19 to <2 x i64>*
store <2 x i64> %26, <2 x i64>* %27
%28 = bitcast %struct.tm* %2 to <2 x i64>*
%29 = load <2 x i64>, <2 x i64>* %28
%30 = bitcast %struct.tm* %9 to <2 x i64>*
%31 = load <2 x i64>, <2 x i64>* %30
%32 = shl <2 x i64> %29, <i64 1, i64 1>
%33 = sub <2 x i64> %32, %31
%34 = bitcast %struct.tm* %2 to <2 x i64>*
store <2 x i64> %33, <2 x i64>* %34
%35 = call i32 @mktime(%struct.tm* %2)
ret i32 %35
}