#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_year;
  int tm_mon;
  int tm_mday;
  scalar_t__ tm_yday;
  scalar_t__ tm_isdst;
  scalar_t__ tm_wday;
  void *tm_sec;
  void *tm_min;
  void *tm_hour;
};
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
void *atoi(char *);
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ mktime(struct tm *);
int /*<<< orphan*/ sprintf(char *, char *, unsigned char);
time_t getStartTime(unsigned char *starttime) {
  int tnum, yy, mm, dd;
  char buf[10];
  time_t l_time;
  time_t end_time;
  struct tm tl;
  struct tm *endtl;
  char cendtime[32];
  char cstarttime[32];
  tnum = (starttime[0] & 0xFF) << 8 | (starttime[1] & 0xFF);
  yy = (tnum - 15078.2) / 365.25;
  mm = ((tnum - 14956.1) - (int)(yy * 365.25)) / 30.6001;
  dd = (tnum - 14956) - (int)(yy * 365.25) - (int)(mm * 30.6001);
  if (mm == 14 || mm == 15) {
    yy += 1;
    mm = mm - 1 - (1 * 12);
  } else {
    mm = mm - 1;
  }
  tl.tm_year = yy;
  tl.tm_mon = mm - 1;
  tl.tm_mday = dd;
  memset(buf, '\0', sizeof(buf));
  sprintf(buf, "%x", starttime[2]);
  tl.tm_hour = atoi(buf);
  memset(buf, '\0', sizeof(buf));
  sprintf(buf, "%x", starttime[3]);
  tl.tm_min = atoi(buf);
  memset(buf, '\0', sizeof(buf));
  sprintf(buf, "%x", starttime[4]);
  tl.tm_sec = atoi(buf);
  tl.tm_wday = 0;
  tl.tm_isdst = 0;
  tl.tm_yday = 0;
  l_time = mktime(&tl);
  return l_time;
}


x86 assembly (clang, -O0):
<getStartTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
and    $0xff,%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
and    $0xff,%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xe9a(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe7e(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x10(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xe6e(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsi2sdl -0x10(%rbp),%xmm1
movsd  0xe55(%rip),%xmm2
mulsd  %xmm2,%xmm1
cvttsd2si %xmm1,%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  0xe35(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x3a6c,%eax
cvtsi2sdl -0x10(%rbp),%xmm0
movsd  0xe1d(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
sub    %ecx,%eax
cvtsi2sdl -0x14(%rbp),%xmm0
movsd  0xdfe(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
sub    %ecx,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0xe,-0x14(%rbp)
je     1223 <getStartTime+0xe3>
cmpl   $0xf,-0x14(%rbp)
jne    123d <getStartTime+0xfd>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
sub    $0xc,%eax
mov    %eax,-0x14(%rbp)
jmp    1246 <getStartTime+0x106>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x70(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x6c(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x68(%rbp)
lea    -0x22(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1030 <memset@plt>
lea    -0x22(%rbp),%rdi
mov    -0x8(%rbp),%rax
lea    0xda6(%rip),%rsi
movzbl 0x2(%rax),%edx
call   1060 <sprintf@plt>
lea    -0x22(%rbp),%rdi
call   1050 <atoi@plt>
mov    %rax,-0x38(%rbp)
lea    -0x22(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1030 <memset@plt>
lea    -0x22(%rbp),%rdi
mov    -0x8(%rbp),%rax
lea    0xd71(%rip),%rsi
movzbl 0x3(%rax),%edx
call   1060 <sprintf@plt>
lea    -0x22(%rbp),%rdi
call   1050 <atoi@plt>
mov    %rax,-0x40(%rbp)
lea    -0x22(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1030 <memset@plt>
lea    -0x22(%rbp),%rdi
mov    -0x8(%rbp),%rax
lea    0xd3c(%rip),%rsi
movzbl 0x4(%rax),%edx
call   1060 <sprintf@plt>
lea    -0x22(%rbp),%rdi
call   1050 <atoi@plt>
mov    %rax,-0x48(%rbp)
movq   $0x0,-0x50(%rbp)
movq   $0x0,-0x58(%rbp)
movq   $0x0,-0x60(%rbp)
lea    -0x70(%rbp),%rdi
call   1040 <mktime@plt>
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getStartTime>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    %rdi,%r14
movzwl (%rdi),%eax
shl    $0x10,%eax
bswap  %eax
cvtsi2sd %eax,%xmm0
movsd  0xea0(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  0xe9c(%rip),%xmm2
divsd  %xmm2,%xmm1
cvttsd2si %xmm1,%r8d
addsd  0xe93(%rip),%xmm0
cvttpd2dq %xmm1,%xmm1
cvtdq2pd %xmm1,%xmm1
mulsd  %xmm2,%xmm1
cvttsd2si %xmm1,%esi
cvttpd2dq %xmm1,%xmm1
cvtdq2pd %xmm1,%xmm1
subsd  %xmm1,%xmm0
movsd  0xe77(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edx
mov    %edx,%edi
and    $0xfffffffe,%edi
lea    -0x1(%rdx),%ebx
add    $0xfffffff3,%edx
xor    %ecx,%ecx
cmp    $0xe,%edi
cvttpd2dq %xmm0,%xmm0
sete   %cl
cvtdq2pd %xmm0,%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
cmovne %ebx,%edx
add    %r8d,%ecx
add    %esi,%edi
neg    %edi
add    %edi,%eax
add    $0xffffc594,%eax
mov    %ecx,(%rsp)
add    $0xffffffff,%edx
mov    %edx,0x4(%rsp)
mov    %eax,0x8(%rsp)
lea    0x46(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1030 <memset@plt>
movzbl 0x2(%r14),%edx
lea    0xe15(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <sprintf@plt>
mov    %rbx,%rdi
call   1050 <atoi@plt>
mov    %rax,0x38(%rsp)
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1030 <memset@plt>
movzbl 0x3(%r14),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <sprintf@plt>
mov    %rbx,%rdi
call   1050 <atoi@plt>
mov    %rax,0x30(%rsp)
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1030 <memset@plt>
movzbl 0x4(%r14),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <sprintf@plt>
mov    %rbx,%rdi
call   1050 <atoi@plt>
mov    %rax,0x28(%rsp)
xorpd  %xmm0,%xmm0
movupd %xmm0,0x10(%rsp)
movq   $0x0,0x20(%rsp)
mov    %rsp,%rdi
call   1040 <mktime@plt>
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i64, i64, i64, i8*, i8*, i8* }
@.str = [3 x i8] c"%x\00"
define i32 @getStartTime(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [10 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca %struct.tm
%11 = alloca %struct.tm*
%12 = alloca [32 x i8]
%13 = alloca [32 x i8]
store i8* %0, i8** %2
%14 = load i8*, i8** %2
%15 = getelementptr inbounds i8, i8* %14, i64 0
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = and i32 %17, 255
%19 = shl i32 %18, 8
%20 = load i8*, i8** %2
%21 = getelementptr inbounds i8, i8* %20, i64 1
%22 = load i8, i8* %21
%23 = zext i8 %22 to i32
%24 = and i32 %23, 255
%25 = or i32 %19, %24
store i32 %25, i32* %3
%26 = load i32, i32* %3
%27 = sitofp i32 %26 to double
%28 = fsub double %27, 1.507820e+04
%29 = fdiv double %28, 3.652500e+02
%30 = fptosi double %29 to i32
store i32 %30, i32* %4
%31 = load i32, i32* %3
%32 = sitofp i32 %31 to double
%33 = fsub double %32, 1.495610e+04
%34 = load i32, i32* %4
%35 = sitofp i32 %34 to double
%36 = fmul double %35, 3.652500e+02
%37 = fptosi double %36 to i32
%38 = sitofp i32 %37 to double
%39 = fsub double %33, %38
%40 = fdiv double %39, 3.060010e+01
%41 = fptosi double %40 to i32
store i32 %41, i32* %5
%42 = load i32, i32* %3
%43 = sub nsw i32 %42, 14956
%44 = load i32, i32* %4
%45 = sitofp i32 %44 to double
%46 = fmul double %45, 3.652500e+02
%47 = fptosi double %46 to i32
%48 = sub nsw i32 %43, %47
%49 = load i32, i32* %5
%50 = sitofp i32 %49 to double
%51 = fmul double %50, 3.060010e+01
%52 = fptosi double %51 to i32
%53 = sub nsw i32 %48, %52
store i32 %53, i32* %6
%54 = load i32, i32* %5
%55 = icmp eq i32 %54, 14
br i1 %55, label %59, label %56
56: ; preds = %1
%57 = load i32, i32* %5
%58 = icmp eq i32 %57, 15
br i1 %58, label %59, label %65
59: ; preds = %56, %1
%60 = load i32, i32* %4
%61 = add nsw i32 %60, 1
store i32 %61, i32* %4
%62 = load i32, i32* %5
%63 = sub nsw i32 %62, 1
%64 = sub nsw i32 %63, 12
store i32 %64, i32* %5
br label %68
65: ; preds = %56
%66 = load i32, i32* %5
%67 = sub nsw i32 %66, 1
store i32 %67, i32* %5
br label %68
68: ; preds = %65, %59
%69 = load i32, i32* %4
%70 = getelementptr inbounds %struct.tm, %struct.tm* %10, i32 0, i32 0
store i32 %69, i32* %70
%71 = load i32, i32* %5
%72 = sub nsw i32 %71, 1
%73 = getelementptr inbounds %struct.tm, %struct.tm* %10, i32 0, i32 1
store i32 %72, i32* %73
%74 = load i32, i32* %6
%75 = getelementptr inbounds %struct.tm, %struct.tm* %10, i32 0, i32 2
store i32 %74, i32* %75
%76 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%77 = call i32 @memset(i8* %76, i8 signext 0, i32 10)
%78 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%79 = load i8*, i8** %2
%80 = getelementptr inbounds i8, i8* %79, i64 2
%81 = load i8, i8* %80
%82 = call i32 @sprintf(i8* %78, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 zeroext %81)
%83 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%84 = call i8* @atoi(i8* %83)
%85 = getelementptr inbounds %struct.tm, %struct.tm* %10, i32 0, i32 8
store i8* %84, i8** %85
%86 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%87 = call i32 @memset(i8* %86, i8 signext 0, i32 10)
%88 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%89 = load i8*, i8** %2
%90 = getelementptr inbounds i8, i8* %89, i64 3
%91 = load i8, i8* %90
%92 = call i32 @sprintf(i8* %88, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 zeroext %91)
%93 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%94 = call i8* @atoi(i8* %93)
%95 = getelementptr inbounds %struct.tm, %struct.tm* %10, i32 0, i32 7
store i8* %94, i8** %95
%96 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%97 = call i32 @memset(i8* %96, i8 signext 0, i32 10)
%98 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%99 = load i8*, i8** %2
%100 = getelementptr inbounds i8, i8* %99, i64 4
%101 = load i8, i8* %100
%102 = call i32 @sprintf(i8* %98, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 zeroext %101)
%103 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%104 = call i8* @atoi(i8* %103)
%105 = getelementptr inbounds %struct.tm, %struct.tm* %10, i32 0, i32 6
store i8* %104, i8** %105
%106 = getelementptr inbounds %struct.tm, %struct.tm* %10, i32 0, i32 5
store i64 0, i64* %106
%107 = getelementptr inbounds %struct.tm, %struct.tm* %10, i32 0, i32 4
store i64 0, i64* %107
%108 = getelementptr inbounds %struct.tm, %struct.tm* %10, i32 0, i32 3
store i64 0, i64* %108
%109 = call i32 @mktime(%struct.tm* %10)
store i32 %109, i32* %8
%110 = load i32, i32* %8
ret i32 %110
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i64, i64, i64, i8*, i8*, i8* }
@.str = [3 x i8] c"%x\00"
define i32 @getStartTime(i8* nocapture %0) {
%2 = alloca [10 x i8]
%3 = alloca %struct.tm
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%5 = bitcast %struct.tm* %3 to i8*
%6 = load i8, i8* %0
%7 = zext i8 %6 to i32
%8 = shl nuw nsw i32 %7, 8
%9 = getelementptr inbounds i8, i8* %0, i64 1
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = or i32 %8, %11
%13 = sitofp i32 %12 to double
%14 = fadd double %13, -1.507820e+04
%15 = fdiv double %14, 3.652500e+02
%16 = fptosi double %15 to i32
%17 = fadd double %13, -1.495610e+04
%18 = sitofp i32 %16 to double
%19 = fmul double %18, 3.652500e+02
%20 = fptosi double %19 to i32
%21 = sitofp i32 %20 to double
%22 = fsub double %17, %21
%23 = fdiv double %22, 3.060010e+01
%24 = fptosi double %23 to i32
%25 = and i32 %24, -2
%26 = icmp eq i32 %25, 14
%27 = select i1 %26, i32 -13, i32 -1
%28 = zext i1 %26 to i32
%29 = add nsw i32 %28, %16
%30 = sitofp i32 %24 to double
%31 = fmul double %30, 3.060010e+01
%32 = fptosi double %31 to i32
%33 = add nsw i32 %12, -14956
%34 = add i32 %20, %32
%35 = sub i32 %33, %34
%36 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 0
store i32 %29, i32* %36
%37 = add i32 %24, -1
%38 = add i32 %37, %27
%39 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 1
store i32 %38, i32* %39
%40 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 2
store i32 %35, i32* %40
%41 = call i32 @memset(i8* %4, i8 signext 0, i32 10)
%42 = getelementptr inbounds i8, i8* %0, i64 2
%43 = load i8, i8* %42
%44 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 zeroext %43)
%45 = call i8* @atoi(i8* %4)
%46 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 8
store i8* %45, i8** %46
%47 = call i32 @memset(i8* %4, i8 signext 0, i32 10)
%48 = getelementptr inbounds i8, i8* %0, i64 3
%49 = load i8, i8* %48
%50 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 zeroext %49)
%51 = call i8* @atoi(i8* %4)
%52 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 7
store i8* %51, i8** %52
%53 = call i32 @memset(i8* %4, i8 signext 0, i32 10)
%54 = getelementptr inbounds i8, i8* %0, i64 4
%55 = load i8, i8* %54
%56 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 zeroext %55)
%57 = call i8* @atoi(i8* %4)
%58 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 6
store i8* %57, i8** %58
%59 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 3
%60 = bitcast i64* %59 to i8*
%61 = call i32 @mktime(%struct.tm* %3)
ret i32 %61
}