#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 */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int /*<<< orphan*/ tm_sec;
  int /*<<< orphan*/ tm_min;
  int /*<<< orphan*/ tm_hour;
  int /*<<< orphan*/ tm_mday;
  scalar_t__ tm_mon;
  scalar_t__ tm_year;
};
struct TYPE_3__ {
  scalar_t__ second_part;
  scalar_t__ neg;
  int /*<<< orphan*/ second;
  int /*<<< orphan*/ minute;
  int /*<<< orphan*/ hour;
  int /*<<< orphan*/ day;
  scalar_t__ month;
  scalar_t__ year;
};
typedef TYPE_1__ MYSQL_TIME;

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
void convert_time(time_t t, MYSQL_TIME *m) {
  struct tm *ptm = NULL;
  if (m == NULL) {
    return;
  }
  ptm = localtime(&t);
  m->year = ptm->tm_year + 1900;
  m->month = ptm->tm_mon + 1;
  m->day = ptm->tm_mday;
  m->hour = ptm->tm_hour;
  m->minute = ptm->tm_min;
  m->second = ptm->tm_sec;
  m->neg = 0;
  m->second_part = 0;
}


x86 assembly (clang, -O0):
<convert_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1137 <convert_time+0x27>
jmp    11bd <convert_time+0xad>
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%rcx
add    $0x76c,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x28(%rax)
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%rcx
add    $0x1,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x20(%rax)
mov    -0x18(%rbp),%rax
mov    0xc(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x1c(%rax)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x18(%rax)
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x14(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x10(%rax)
mov    -0x10(%rbp),%rax
movq   $0x0,0x8(%rax)
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_time>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,0xc(%rsp)
test   %rsi,%rsi
je     114a <convert_time+0x3a>
mov    %rsi,%rbx
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
movdqu 0x10(%rax),%xmm0
paddq  0xec8(%rip),%xmm0
movdqu %xmm0,0x20(%rbx)
movups (%rax),%xmm0
movups %xmm0,0x10(%rbx)
xorps  %xmm0,%xmm0
movups %xmm0,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i64, i64, i32, i32, i32, i32, i64, i64 }
%struct.tm = type { i32, i32, i32, i32, i64, i64 }
define void @convert_time(i32 %0, %struct.TYPE_3__* %1) {
%3 = alloca i32
%4 = alloca %struct.TYPE_3__*
%5 = alloca %struct.tm*
store i32 %0, i32* %3
store %struct.TYPE_3__* %1, %struct.TYPE_3__** %4
store %struct.tm* null, %struct.tm** %5
%6 = load %struct.TYPE_3__*, %struct.TYPE_3__** %4
%7 = icmp eq %struct.TYPE_3__* %6, null
br i1 %7, label %8, label %9
8: ; preds = %2
br label %47
9: ; preds = %2
%10 = call %struct.tm* @localtime(i32* %3)
store %struct.tm* %10, %struct.tm** %5
%11 = load %struct.tm*, %struct.tm** %5
%12 = getelementptr inbounds %struct.tm, %struct.tm* %11, i32 0, i32 5
%13 = load i64, i64* %12
%14 = add nsw i64 %13, 1900
%15 = load %struct.TYPE_3__*, %struct.TYPE_3__** %4
%16 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %15, i32 0, i32 7
store i64 %14, i64* %16
%17 = load %struct.tm*, %struct.tm** %5
%18 = getelementptr inbounds %struct.tm, %struct.tm* %17, i32 0, i32 4
%19 = load i64, i64* %18
%20 = add nsw i64 %19, 1
%21 = load %struct.TYPE_3__*, %struct.TYPE_3__** %4
%22 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %21, i32 0, i32 6
store i64 %20, i64* %22
%23 = load %struct.tm*, %struct.tm** %5
%24 = getelementptr inbounds %struct.tm, %struct.tm* %23, i32 0, i32 3
%25 = load i32, i32* %24
%26 = load %struct.TYPE_3__*, %struct.TYPE_3__** %4
%27 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %26, i32 0, i32 5
store i32 %25, i32* %27
%28 = load %struct.tm*, %struct.tm** %5
%29 = getelementptr inbounds %struct.tm, %struct.tm* %28, i32 0, i32 2
%30 = load i32, i32* %29
%31 = load %struct.TYPE_3__*, %struct.TYPE_3__** %4
%32 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %31, i32 0, i32 4
store i32 %30, i32* %32
%33 = load %struct.tm*, %struct.tm** %5
%34 = getelementptr inbounds %struct.tm, %struct.tm* %33, i32 0, i32 1
%35 = load i32, i32* %34
%36 = load %struct.TYPE_3__*, %struct.TYPE_3__** %4
%37 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %36, i32 0, i32 3
store i32 %35, i32* %37
%38 = load %struct.tm*, %struct.tm** %5
%39 = getelementptr inbounds %struct.tm, %struct.tm* %38, i32 0, i32 0
%40 = load i32, i32* %39
%41 = load %struct.TYPE_3__*, %struct.TYPE_3__** %4
%42 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %41, i32 0, i32 2
store i32 %40, i32* %42
%43 = load %struct.TYPE_3__*, %struct.TYPE_3__** %4
%44 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %43, i32 0, i32 1
store i64 0, i64* %44
%45 = load %struct.TYPE_3__*, %struct.TYPE_3__** %4
%46 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %45, i32 0, i32 0
store i64 0, i64* %46
br label %47
47: ; preds = %9, %8
ret void
}

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