#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 scalar_t__ time_t;
struct tm {
  int tm_sec;
  int tm_min;
  int tm_hour;
  int tm_mday;
  int tm_mon;
  int tm_year;
  int tm_isdst;
};

/* Variables and functions */
scalar_t__ mktime(struct tm *);
int /*<<< orphan*/ printf(char *, char *, unsigned long, int, char const *);
void ok(int sec, int min, int hour, int day, int month, int year, int isdst,
        time_t expect_time, int expect_isdst, const char *title) {
  struct tm s;
  s.tm_sec = sec;
  s.tm_min = min;
  s.tm_hour = hour;
  s.tm_mday = day;
  s.tm_mon = month;
  s.tm_year = year;
  s.tm_isdst = isdst;
  time_t result = mktime(&s);
  printf("  %s: got t=%-10lu expected t=%-10lu --  %s\n",
         (result == expect_time ? "okay" : "FAIL"), (unsigned long)result,
         (unsigned long)expect_time, title);
  printf("  %s: got dst=%-8d expected dst=%-8d --  %s\n",
         (s.tm_isdst == expect_isdst ? "okay" : "FAIL"), s.tm_isdst,
         expect_isdst, title);
}


x86 assembly (clang, -O0):
<ok>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    0x10(%rbp),%eax
mov    %eax,-0x20(%rbp)
lea    -0x38(%rbp),%rdi
call   1040 <mktime@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rcx
mov    0x18(%rbp),%rdx
lea    0xea2(%rip),%rsi
lea    0xe96(%rip),%rax
cmp    %rdx,%rcx
cmove  %rax,%rsi
mov    -0x40(%rbp),%rdx
mov    0x18(%rbp),%rax
mov    %eax,%ecx
mov    0x28(%rbp),%r8
lea    0xe4d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%ecx
mov    0x20(%rbp),%edx
lea    0xe6d(%rip),%rsi
lea    0xe61(%rip),%rax
cmp    %edx,%ecx
cmove  %rax,%rsi
movslq -0x20(%rbp),%rdx
mov    0x20(%rbp),%ecx
mov    0x28(%rbp),%r8
lea    0xe53(%rip),%rdi
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ok>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    0x60(%rsp),%r15d
mov    0x68(%rsp),%r14
mov    0x58(%rsp),%rbx
mov    0x50(%rsp),%eax
mov    %edi,(%rsp)
mov    %esi,0x4(%rsp)
mov    %edx,0x8(%rsp)
mov    %ecx,0xc(%rsp)
mov    %r8d,0x10(%rsp)
mov    %r9d,0x14(%rsp)
mov    %eax,0x18(%rsp)
mov    %rsp,%rdi
call   1040 <mktime@plt>
cmp    %rbx,%rax
lea    0xebf(%rip),%r12
lea    0xebd(%rip),%rbp
mov    %rbp,%rsi
cmove  %r12,%rsi
lea    0xe7d(%rip),%rdi
mov    %rax,%rdx
mov    %ebx,%ecx
mov    %r14,%r8
call   1030 <printf@plt>
movslq 0x18(%rsp),%rdx
cmp    %r15d,%edx
cmove  %r12,%rbp
lea    0xe94(%rip),%rdi
mov    %rbp,%rsi
mov    %r15d,%ecx
mov    %r14,%r8
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32, i32 }
@.str = [45 x i8] c" %s: got t=%-10lu expected t=%-10lu -- %s\0A\00"
@.str.1 = [5 x i8] c"okay\00"
@.str.2 = [5 x i8] c"FAIL\00"
@.str.3 = [45 x i8] c" %s: got dst=%-8d expected dst=%-8d -- %s\0A\00"
define void @ok(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i64 %7, i32 %8, i8* %9) {
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i64
%19 = alloca i32
%20 = alloca i8*
%21 = alloca %struct.tm
%22 = alloca i64
store i32 %0, i32* %11
store i32 %1, i32* %12
store i32 %2, i32* %13
store i32 %3, i32* %14
store i32 %4, i32* %15
store i32 %5, i32* %16
store i32 %6, i32* %17
store i64 %7, i64* %18
store i32 %8, i32* %19
store i8* %9, i8** %20
%23 = load i32, i32* %11
%24 = getelementptr inbounds %struct.tm, %struct.tm* %21, i32 0, i32 0
store i32 %23, i32* %24
%25 = load i32, i32* %12
%26 = getelementptr inbounds %struct.tm, %struct.tm* %21, i32 0, i32 1
store i32 %25, i32* %26
%27 = load i32, i32* %13
%28 = getelementptr inbounds %struct.tm, %struct.tm* %21, i32 0, i32 2
store i32 %27, i32* %28
%29 = load i32, i32* %14
%30 = getelementptr inbounds %struct.tm, %struct.tm* %21, i32 0, i32 3
store i32 %29, i32* %30
%31 = load i32, i32* %15
%32 = getelementptr inbounds %struct.tm, %struct.tm* %21, i32 0, i32 4
store i32 %31, i32* %32
%33 = load i32, i32* %16
%34 = getelementptr inbounds %struct.tm, %struct.tm* %21, i32 0, i32 5
store i32 %33, i32* %34
%35 = load i32, i32* %17
%36 = getelementptr inbounds %struct.tm, %struct.tm* %21, i32 0, i32 6
store i32 %35, i32* %36
%37 = call i64 @mktime(%struct.tm* %21)
store i64 %37, i64* %22
%38 = load i64, i64* %22
%39 = load i64, i64* %18
%40 = icmp eq i64 %38, %39
%41 = zext i1 %40 to i64
%42 = select i1 %40, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%43 = load i64, i64* %22
%44 = load i64, i64* %18
%45 = trunc i64 %44 to i32
%46 = load i8*, i8** %20
%47 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %42, i64 %43, i32 %45, i8* %46)
%48 = getelementptr inbounds %struct.tm, %struct.tm* %21, i32 0, i32 6
%49 = load i32, i32* %48
%50 = load i32, i32* %19
%51 = icmp eq i32 %49, %50
%52 = zext i1 %51 to i64
%53 = select i1 %51, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%54 = getelementptr inbounds %struct.tm, %struct.tm* %21, i32 0, i32 6
%55 = load i32, i32* %54
%56 = sext i32 %55 to i64
%57 = load i32, i32* %19
%58 = load i8*, i8** %20
%59 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i8* %53, i64 %56, i32 %57, i8* %58)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32, i32 }
@.str = [45 x i8] c" %s: got t=%-10lu expected t=%-10lu -- %s\0A\00"
@.str.1 = [5 x i8] c"okay\00"
@.str.2 = [5 x i8] c"FAIL\00"
@.str.3 = [45 x i8] c" %s: got dst=%-8d expected dst=%-8d -- %s\0A\00"
define void @ok(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i64 %7, i32 %8, i8* %9) {
%11 = alloca %struct.tm
%12 = bitcast %struct.tm* %11 to i8*
%13 = getelementptr inbounds %struct.tm, %struct.tm* %11, i64 0, i32 0
store i32 %0, i32* %13
%14 = getelementptr inbounds %struct.tm, %struct.tm* %11, i64 0, i32 1
store i32 %1, i32* %14
%15 = getelementptr inbounds %struct.tm, %struct.tm* %11, i64 0, i32 2
store i32 %2, i32* %15
%16 = getelementptr inbounds %struct.tm, %struct.tm* %11, i64 0, i32 3
store i32 %3, i32* %16
%17 = getelementptr inbounds %struct.tm, %struct.tm* %11, i64 0, i32 4
store i32 %4, i32* %17
%18 = getelementptr inbounds %struct.tm, %struct.tm* %11, i64 0, i32 5
store i32 %5, i32* %18
%19 = getelementptr inbounds %struct.tm, %struct.tm* %11, i64 0, i32 6
store i32 %6, i32* %19
%20 = call i64 @mktime(%struct.tm* %11)
%21 = icmp eq i64 %20, %7
%22 = select i1 %21, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%23 = trunc i64 %7 to i32
%24 = tail call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %22, i64 %20, i32 %23, i8* %9)
%25 = load i32, i32* %19
%26 = icmp eq i32 %25, %8
%27 = select i1 %26, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%28 = sext i32 %25 to i64
%29 = tail call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i8* %27, i64 %28, i32 %8, i8* %9)
ret void
}