#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_year;
};

/* Variables and functions */
int /*<<< orphan*/ adjhour(struct tm *, char, int, int /*<<< orphan*/);
int mktime(struct tm *);
int domktime(struct tm *t, char type) {
  time_t ret;
  while ((ret = mktime(t)) == -1 && t->tm_year > 68 && t->tm_year < 138)
    adjhour(t, type == '-' ? type : '+', 1, 0);
  return ret;
}


x86 assembly (clang, -O0):
<domktime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <mktime@plt>
mov    %eax,%ecx
mov    %ecx,-0x10(%rbp)
xor    %eax,%eax
cmp    $0xffffffff,%ecx
mov    %al,-0x11(%rbp)
jne    1170 <domktime+0x50>
mov    -0x8(%rbp),%rcx
xor    %eax,%eax
cmpl   $0x44,(%rcx)
mov    %al,-0x11(%rbp)
jle    1170 <domktime+0x50>
mov    -0x8(%rbp),%rax
cmpl   $0x8a,(%rax)
setl   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1180 <domktime+0x60>
jmp    11c9 <domktime+0xa9>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0x2d,%eax
jne    11a1 <domktime+0x81>
movsbl -0x9(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    11ae <domktime+0x8e>
mov    $0x2b,%eax
mov    %eax,-0x24(%rbp)
jmp    11ae <domktime+0x8e>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%eax
mov    $0x1,%edx
xor    %ecx,%ecx
movsbl %al,%esi
call   1040 <adjhour@plt>
jmp    1132 <domktime+0x12>
mov    -0x10(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<domktime>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <mktime@plt>
cmp    $0xffffffff,%eax
jne    116f <domktime+0x4f>
cmp    $0x2d,%bpl
sete   %al
add    %al,%al
add    $0x2b,%al
movzbl %al,%ebp
mov    (%rbx),%eax
add    $0xffffffbb,%eax
cmp    $0x44,%eax
ja     116a <domktime+0x4a>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1040 <adjhour@plt>
mov    %rbx,%rdi
call   1030 <mktime@plt>
cmp    $0xffffffff,%eax
je     1140 <domktime+0x20>
jmp    116f <domktime+0x4f>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
define i32 @domktime(%struct.tm* %0, i8 signext %1) {
%3 = alloca %struct.tm*
%4 = alloca i8
%5 = alloca i32
store %struct.tm* %0, %struct.tm** %3
store i8 %1, i8* %4
br label %6
6: ; preds = %31, %2
%7 = load %struct.tm*, %struct.tm** %3
%8 = call i32 @mktime(%struct.tm* %7)
store i32 %8, i32* %5
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load %struct.tm*, %struct.tm** %3
%12 = getelementptr inbounds %struct.tm, %struct.tm* %11, i32 0, i32 0
%13 = load i32, i32* %12
%14 = icmp sgt i32 %13, 68
br i1 %14, label %15, label %20
15: ; preds = %10
%16 = load %struct.tm*, %struct.tm** %3
%17 = getelementptr inbounds %struct.tm, %struct.tm* %16, i32 0, i32 0
%18 = load i32, i32* %17
%19 = icmp slt i32 %18, 138
br label %20
20: ; preds = %15, %10, %6
%21 = phi i1 [ false, %10 ], [ false, %6 ], [ %19, %15 ]
br i1 %21, label %22, label %35
22: ; preds = %20
%23 = load %struct.tm*, %struct.tm** %3
%24 = load i8, i8* %4
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 45
br i1 %26, label %27, label %30
27: ; preds = %22
%28 = load i8, i8* %4
%29 = sext i8 %28 to i32
br label %31
30: ; preds = %22
br label %31
31: ; preds = %30, %27
%32 = phi i32 [ %29, %27 ], [ 43, %30 ]
%33 = trunc i32 %32 to i8
%34 = call i32 @adjhour(%struct.tm* %23, i8 signext %33, i32 1, i32 0)
br label %6
35: ; preds = %20
%36 = load i32, i32* %5
ret i32 %36
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define i32 @domktime(%struct.tm* %0, i8 signext %1) {
%3 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 0
%4 = tail call i32 @mktime(%struct.tm* %0)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %17
6: ; preds = %2
%7 = icmp eq i8 %1, 45
%8 = select i1 %7, i8 45, i8 43
br label %9
9: ; preds = %6, %13
%10 = load i32, i32* %3
%11 = add i32 %10, -69
%12 = icmp ult i32 %11, 69
br i1 %12, label %13, label %17
13: ; preds = %9
%14 = tail call i32 @adjhour(%struct.tm* %0, i8 signext %8, i32 1, i32 0)
%15 = tail call i32 @mktime(%struct.tm* %0)
%16 = icmp eq i32 %15, -1
br i1 %16, label %9, label %17
17: ; preds = %9, %13, %2
%18 = phi i32 [ %4, %2 ], [ %15, %13 ], [ -1, %9 ]
ret i32 %18
}