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

/* Variables and functions */
void *atof(char *);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ mktime(struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
time_t convert_time(int local_argc, char **local_argv) {
  time_t rawtime;
  struct tm *info;
  time(&rawtime);
  info = localtime(&rawtime);
  info->tm_hour = atof(local_argv[0]);
  info->tm_min = 0;
  info->tm_sec = 0;
  if (local_argc > 1) {
    info->tm_mday = atof(local_argv[1]);
  }
  if (local_argc > 2) {
    info->tm_mon = atof(local_argv[2]) - 1;
  }
  if (local_argc > 3) {
    info->tm_year = atof(local_argv[3]) - 1900;
  }
  info->tm_isdst = 0;
  mktime(info);
  if (info->tm_isdst == 1) {
    info->tm_hour--;
  }
  return mktime(info);
}


x86 assembly (clang, -O0):
<convert_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x14(%rbp),%rdi
call   1050 <time@plt>
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <atof@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x20(%rbp),%rax
movq   $0x0,0x30(%rax)
mov    -0x20(%rbp),%rax
movq   $0x0,0x28(%rax)
cmpl   $0x1,-0x4(%rbp)
jle    11b6 <convert_time+0x76>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atof@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,0x20(%rax)
cmpl   $0x2,-0x4(%rbp)
jle    11dc <convert_time+0x9c>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <atof@plt>
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,0x18(%rax)
cmpl   $0x3,-0x4(%rbp)
jle    1205 <convert_time+0xc5>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1040 <atof@plt>
mov    %rax,%rcx
add    $0xfffffffffffff894,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,0x10(%rax)
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x20(%rbp),%rdi
call   1060 <mktime@plt>
mov    -0x20(%rbp),%rax
cmpl   $0x1,(%rax)
jne    1235 <convert_time+0xf5>
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,0x8(%rax)
mov    -0x20(%rbp),%rdi
call   1060 <mktime@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_time>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %edi,%ebp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
mov    %rax,%rbx
mov    (%r14),%rdi
call   1040 <atof@plt>
mov    %rax,0x8(%rbx)
xorps  %xmm0,%xmm0
movups %xmm0,0x28(%rbx)
cmp    $0x2,%ebp
jl     11b8 <convert_time+0x78>
mov    0x8(%r14),%rdi
call   1040 <atof@plt>
mov    %rax,0x20(%rbx)
cmp    $0x2,%ebp
je     11b8 <convert_time+0x78>
mov    0x10(%r14),%rdi
call   1040 <atof@plt>
add    $0xffffffffffffffff,%rax
mov    %rax,0x18(%rbx)
cmp    $0x4,%ebp
jb     11b8 <convert_time+0x78>
mov    0x18(%r14),%rdi
call   1040 <atof@plt>
add    $0xfffffffffffff894,%rax
mov    %rax,0x10(%rbx)
movl   $0x0,(%rbx)
mov    %rbx,%rdi
call   1060 <mktime@plt>
cmpl   $0x1,(%rbx)
jne    11d0 <convert_time+0x90>
addq   $0xffffffffffffffff,0x8(%rbx)
mov    %rbx,%rdi
call   1060 <mktime@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
%struct.tm = type { i32, i8*, i8*, i8*, i8*, i64, i64 }
define i32 @convert_time(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @time(i32* %3)
%6 = call %struct.tm* @localtime(i32* %3)
%7 = load i8*, i8** %1
%8 = call i8* @atof(i8* %7)
%9 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 1
store i8* %8, i8** %9
%10 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 5
%11 = icmp sgt i32 %0, 1
%12 = bitcast i64* %10 to i8*
br i1 %11, label %13, label %32
13: ; preds = %2
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = call i8* @atof(i8* %15)
%17 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 4
store i8* %16, i8** %17
%18 = icmp eq i32 %0, 2
br i1 %18, label %32, label %19
19: ; preds = %13
%20 = getelementptr inbounds i8*, i8** %1, i64 2
%21 = load i8*, i8** %20
%22 = call i8* @atof(i8* %21)
%23 = getelementptr i8, i8* %22, i64 -1
%24 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 3
store i8* %23, i8** %24
%25 = icmp ugt i32 %0, 3
br i1 %25, label %26, label %32
26: ; preds = %19
%27 = getelementptr inbounds i8*, i8** %1, i64 3
%28 = load i8*, i8** %27
%29 = call i8* @atof(i8* %28)
%30 = getelementptr i8, i8* %29, i64 -1900
%31 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 2
store i8* %30, i8** %31
br label %32
32: ; preds = %2, %13, %26, %19
%33 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 0
store i32 0, i32* %33
%34 = call i32 @mktime(%struct.tm* %6)
%35 = load i32, i32* %33
%36 = icmp eq i32 %35, 1
br i1 %36, label %37, label %40
37: ; preds = %32
%38 = load i8*, i8** %9
%39 = getelementptr inbounds i8, i8* %38, i64 -1
store i8* %39, i8** %9
br label %40
40: ; preds = %37, %32
%41 = call i32 @mktime(%struct.tm* %6)
ret i32 %41
}