#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 */
struct tm {
  int /*<<< orphan*/ tm_sec;
  int /*<<< orphan*/ tm_min;
  int /*<<< orphan*/ tm_hour;
  int /*<<< orphan*/ tm_mday;
  int /*<<< orphan*/ tm_mon;
  int /*<<< orphan*/ tm_year;
};

/* Variables and functions */
int intcomp(int /*<<< orphan*/, int /*<<< orphan*/);
int tmcomp(const struct tm *tm1, const struct tm *tm2) {
  int rtn;
  if (rtn = intcomp(tm1->tm_year, tm2->tm_year))
    return rtn;
  if (rtn = intcomp(tm1->tm_mon, tm2->tm_mon))
    return rtn;
  if (rtn = intcomp(tm1->tm_mday, tm2->tm_mday))
    return rtn;
  if (rtn = intcomp(tm1->tm_hour, tm2->tm_hour))
    return rtn;
  if (rtn = intcomp(tm1->tm_min, tm2->tm_min))
    return rtn;
  return intcomp(tm1->tm_sec, tm2->tm_sec);
}


x86 assembly (clang, -O0):
<tmcomp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x14(%rax),%edi
mov    -0x18(%rbp),%rax
mov    0x14(%rax),%esi
call   1030 <intcomp@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
je     114a <tmcomp+0x3a>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1206 <tmcomp+0xf6>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%edi
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%esi
call   1030 <intcomp@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
je     1174 <tmcomp+0x64>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1206 <tmcomp+0xf6>
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%edi
mov    -0x18(%rbp),%rax
mov    0xc(%rax),%esi
call   1030 <intcomp@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
je     119e <tmcomp+0x8e>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1206 <tmcomp+0xf6>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%edi
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%esi
call   1030 <intcomp@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
je     11c8 <tmcomp+0xb8>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1206 <tmcomp+0xf6>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edi
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%esi
call   1030 <intcomp@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
je     11f2 <tmcomp+0xe2>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1206 <tmcomp+0xf6>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
call   1030 <intcomp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tmcomp>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x14(%rdi),%edi
mov    0x14(%rsi),%esi
call   1030 <intcomp@plt>
test   %eax,%eax
jne    1169 <tmcomp+0x59>
mov    0x10(%rbx),%edi
mov    0x10(%r14),%esi
call   1030 <intcomp@plt>
test   %eax,%eax
jne    1169 <tmcomp+0x59>
mov    0xc(%rbx),%edi
mov    0xc(%r14),%esi
call   1030 <intcomp@plt>
test   %eax,%eax
jne    1169 <tmcomp+0x59>
mov    0x8(%rbx),%edi
mov    0x8(%r14),%esi
call   1030 <intcomp@plt>
test   %eax,%eax
jne    1169 <tmcomp+0x59>
mov    0x4(%rbx),%edi
mov    0x4(%r14),%esi
call   1030 <intcomp@plt>
test   %eax,%eax
je     1171 <tmcomp+0x61>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    (%rbx),%edi
mov    (%r14),%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <intcomp@plt>

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

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
define i32 @tmcomp(%struct.tm* nocapture %0, %struct.tm* nocapture %1) {
%3 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 5
%4 = load i32, i32* %3
%5 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 5
%6 = load i32, i32* %5
%7 = tail call i32 @intcomp(i32 %4, i32 %6)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %43
9: ; preds = %2
%10 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 4
%11 = load i32, i32* %10
%12 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 4
%13 = load i32, i32* %12
%14 = tail call i32 @intcomp(i32 %11, i32 %13)
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %43
16: ; preds = %9
%17 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 3
%18 = load i32, i32* %17
%19 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 3
%20 = load i32, i32* %19
%21 = tail call i32 @intcomp(i32 %18, i32 %20)
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %43
23: ; preds = %16
%24 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 2
%25 = load i32, i32* %24
%26 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 2
%27 = load i32, i32* %26
%28 = tail call i32 @intcomp(i32 %25, i32 %27)
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %43
30: ; preds = %23
%31 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 1
%32 = load i32, i32* %31
%33 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 1
%34 = load i32, i32* %33
%35 = tail call i32 @intcomp(i32 %32, i32 %34)
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %43
37: ; preds = %30
%38 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 0
%39 = load i32, i32* %38
%40 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 0
%41 = load i32, i32* %40
%42 = tail call i32 @intcomp(i32 %39, i32 %41)
br label %43
43: ; preds = %30, %23, %16, %9, %2, %37
%44 = phi i32 [ %42, %37 ], [ %7, %2 ], [ %14, %9 ], [ %21, %16 ], [ %28, %23 ], [ %35, %30 ]
ret i32 %44
}