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

/* Variables and functions */
int mktime(struct tm *);
int test(void) {
  struct tm timestruct;
  time_t time_encoded;
  timestruct.tm_sec = 0;
  timestruct.tm_min = 0;
  timestruct.tm_hour = 0;
  timestruct.tm_mday = 1;
  timestruct.tm_mon = 0;
  timestruct.tm_year = 0;
  timestruct.tm_wday = 0;
  timestruct.tm_yday = 0;
  timestruct.tm_isdst = 0;
  time_encoded = mktime(&timestruct);
  return (time_encoded != -1);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movq   $0x0,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x1,-0x48(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
lea    -0x48(%rbp),%rdi
call   1030 <mktime@plt>
mov    %eax,-0x4c(%rbp)
cmpl   $0xffffffff,-0x4c(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
sub    $0x48,%rsp
xorps  %xmm0,%xmm0
movups %xmm0,0x30(%rsp)
movq   $0x0,0x40(%rsp)
movl   $0x1,(%rsp)
movups %xmm0,0x8(%rsp)
movups %xmm0,0x18(%rsp)
movq   $0x0,0x28(%rsp)
mov    %rsp,%rdi
call   1030 <mktime@plt>
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
setne  %cl
mov    %ecx,%eax
add    $0x48,%rsp
ret

LLVM IR (-O0):
%struct.tm = type { i32, i64, i64, i64, i64, i64, i64, i64, i64 }
define i32 @test() {
%1 = alloca %struct.tm
%2 = alloca i32
%3 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 8
store i64 0, i64* %3
%4 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 7
store i64 0, i64* %4
%5 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 6
store i64 0, i64* %5
%6 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 0
store i32 1, i32* %6
%7 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 5
store i64 0, i64* %7
%8 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 4
store i64 0, i64* %8
%9 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 3
store i64 0, i64* %9
%10 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 2
store i64 0, i64* %10
%11 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 1
store i64 0, i64* %11
%12 = call i32 @mktime(%struct.tm* %1)
store i32 %12, i32* %2
%13 = load i32, i32* %2
%14 = icmp ne i32 %13, -1
%15 = zext i1 %14 to i32
ret i32 %15
}

LLVM IR (-O2):
%struct.tm = type { i32, i64, i64, i64, i64, i64, i64, i64, i64 }
define i32 @test() {
%1 = alloca %struct.tm
%2 = bitcast %struct.tm* %1 to i8*
%3 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 6
%4 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 0
%5 = bitcast i64* %3 to i8*
store i32 1, i32* %4
%6 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 1
%7 = bitcast i64* %6 to i8*
%8 = call i32 @mktime(%struct.tm* %1)
%9 = icmp ne i32 %8, -1
%10 = zext i1 %9 to i32
ret i32 %10
}