#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 {
  scalar_t__ tm_mday;
  scalar_t__ tm_hour;
  scalar_t__ tm_min;
  scalar_t__ tm_sec;
};

/* Variables and functions */
int /*<<< orphan*/ EINVAL;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ tm_addmonths(struct tm *, int);
int tm_diffcalendarmonths(struct tm, struct tm);
int tm_diffdays(struct tm, struct tm, int *);
scalar_t__ tm_diffseconds(struct tm, struct tm);
scalar_t__ tm_getrepresentation(struct tm);
int tm_diffmonths(struct tm debut, struct tm fin, int *days, int *seconds) {
  if (tm_getrepresentation(debut) != tm_getrepresentation(fin)) {
    errno = EINVAL;
    return 0;
  }
  int coeff = 1;
  if (tm_diffseconds(debut, fin) < 0) {
    struct tm tmp = debut;
    debut = fin;
    fin = tmp;
    coeff = -1;
  }
  int ret = tm_diffcalendarmonths(debut, fin);
  if (fin.tm_mday < debut.tm_mday ||
      (fin.tm_mday == debut.tm_mday && fin.tm_hour < debut.tm_hour) ||
      (fin.tm_mday == debut.tm_mday && fin.tm_hour == debut.tm_hour &&
       fin.tm_min < debut.tm_min) ||
      (fin.tm_mday == debut.tm_mday && fin.tm_hour == debut.tm_hour &&
       fin.tm_min == debut.tm_min && fin.tm_sec < debut.tm_sec))
    if (ret > 0)
      ret--;
  if (days) {
    tm_addmonths(&debut, ret);
    *days = coeff * tm_diffdays(debut, fin, seconds);
    if (seconds)
      *seconds *= coeff;
  }
  return coeff * ret;
}


x86 assembly (clang, -O0):
<tm_diffmonths>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
lea    0x30(%rbp),%rax
mov    %rax,-0x58(%rbp)
lea    0x10(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    (%rax),%rcx
mov    %rcx,(%rsp)
mov    0x8(%rax),%rcx
mov    %rcx,0x8(%rsp)
mov    0x10(%rax),%rcx
mov    %rcx,0x10(%rsp)
mov    0x18(%rax),%rax
mov    %rax,0x18(%rsp)
call   1040 <tm_getrepresentation@plt>
mov    %rax,%rcx
mov    -0x58(%rbp),%rax
mov    %rcx,-0x50(%rbp)
mov    (%rax),%rcx
mov    %rcx,(%rsp)
mov    0x8(%rax),%rcx
mov    %rcx,0x8(%rsp)
mov    0x10(%rax),%rcx
mov    %rcx,0x10(%rsp)
mov    0x18(%rax),%rax
mov    %rax,0x18(%rsp)
call   1040 <tm_getrepresentation@plt>
mov    %rax,%rcx
mov    -0x50(%rbp),%rax
cmp    %rcx,%rax
je     11fa <tm_diffmonths+0xaa>
mov    0x2df5(%rip),%rax
mov    (%rax),%ecx
mov    0x2df4(%rip),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    14b0 <tm_diffmonths+0x360>
mov    -0x58(%rbp),%rax
mov    -0x60(%rbp),%rcx
movl   $0x1,-0x1c(%rbp)
mov    (%rcx),%rdx
mov    %rdx,(%rsp)
mov    0x8(%rcx),%rdx
mov    %rdx,0x8(%rsp)
mov    0x10(%rcx),%rdx
mov    %rdx,0x10(%rsp)
mov    0x18(%rcx),%rcx
mov    %rcx,0x18(%rsp)
mov    (%rax),%rcx
mov    %rcx,0x20(%rsp)
mov    0x8(%rax),%rcx
mov    %rcx,0x28(%rsp)
mov    0x10(%rax),%rcx
mov    %rcx,0x30(%rsp)
mov    0x18(%rax),%rax
mov    %rax,0x38(%rsp)
call   1030 <tm_diffseconds@plt>
cmp    $0x0,%rax
jge    12c8 <tm_diffmonths+0x178>
mov    -0x58(%rbp),%rax
mov    -0x60(%rbp),%rcx
mov    (%rcx),%rdx
mov    %rdx,-0x40(%rbp)
mov    0x8(%rcx),%rdx
mov    %rdx,-0x38(%rbp)
mov    0x10(%rcx),%rdx
mov    %rdx,-0x30(%rbp)
mov    0x18(%rcx),%rdx
mov    %rdx,-0x28(%rbp)
mov    (%rax),%rdx
mov    %rdx,(%rcx)
mov    0x8(%rax),%rdx
mov    %rdx,0x8(%rcx)
mov    0x10(%rax),%rdx
mov    %rdx,0x10(%rcx)
mov    0x18(%rax),%rdx
mov    %rdx,0x18(%rcx)
mov    -0x40(%rbp),%rcx
mov    %rcx,(%rax)
mov    -0x38(%rbp),%rcx
mov    %rcx,0x8(%rax)
mov    -0x30(%rbp),%rcx
mov    %rcx,0x10(%rax)
mov    -0x28(%rbp),%rcx
mov    %rcx,0x18(%rax)
movl   $0xffffffff,-0x1c(%rbp)
mov    -0x60(%rbp),%rcx
mov    -0x58(%rbp),%rax
mov    (%rcx),%rdx
mov    %rdx,(%rsp)
mov    0x8(%rcx),%rdx
mov    %rdx,0x8(%rsp)
mov    0x10(%rcx),%rdx
mov    %rdx,0x10(%rsp)
mov    0x18(%rcx),%rcx
mov    %rcx,0x18(%rsp)
mov    (%rax),%rcx
mov    %rcx,0x20(%rsp)
mov    0x8(%rax),%rcx
mov    %rcx,0x28(%rsp)
mov    0x10(%rax),%rcx
mov    %rcx,0x30(%rsp)
mov    0x18(%rax),%rax
mov    %rax,0x38(%rsp)
call   1070 <tm_diffcalendarmonths@plt>
mov    -0x60(%rbp),%rcx
mov    %eax,%edx
mov    -0x58(%rbp),%rax
mov    %edx,-0x44(%rbp)
mov    (%rax),%rax
cmp    (%rcx),%rax
jl     13f3 <tm_diffmonths+0x2a3>
mov    -0x60(%rbp),%rcx
mov    -0x58(%rbp),%rax
mov    (%rax),%rax
cmp    (%rcx),%rax
jne    135d <tm_diffmonths+0x20d>
mov    -0x60(%rbp),%rcx
mov    -0x58(%rbp),%rax
mov    0x8(%rax),%rax
cmp    0x8(%rcx),%rax
jl     13f3 <tm_diffmonths+0x2a3>
mov    -0x60(%rbp),%rcx
mov    -0x58(%rbp),%rax
mov    (%rax),%rax
cmp    (%rcx),%rax
jne    139d <tm_diffmonths+0x24d>
mov    -0x60(%rbp),%rcx
mov    -0x58(%rbp),%rax
mov    0x8(%rax),%rax
cmp    0x8(%rcx),%rax
jne    139d <tm_diffmonths+0x24d>
mov    -0x60(%rbp),%rcx
mov    -0x58(%rbp),%rax
mov    0x10(%rax),%rax
cmp    0x10(%rcx),%rax
jl     13f3 <tm_diffmonths+0x2a3>
mov    -0x60(%rbp),%rcx
mov    -0x58(%rbp),%rax
mov    (%rax),%rax
cmp    (%rcx),%rax
jne    140b <tm_diffmonths+0x2bb>
mov    -0x60(%rbp),%rcx
mov    -0x58(%rbp),%rax
mov    0x8(%rax),%rax
cmp    0x8(%rcx),%rax
jne    140b <tm_diffmonths+0x2bb>
mov    -0x60(%rbp),%rcx
mov    -0x58(%rbp),%rax
mov    0x10(%rax),%rax
cmp    0x10(%rcx),%rax
jne    140b <tm_diffmonths+0x2bb>
mov    -0x60(%rbp),%rcx
mov    -0x58(%rbp),%rax
mov    0x18(%rax),%rax
cmp    0x18(%rcx),%rax
jge    140b <tm_diffmonths+0x2bb>
cmpl   $0x0,-0x44(%rbp)
jle    1406 <tm_diffmonths+0x2b6>
mov    -0x44(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x44(%rbp)
jmp    140b <tm_diffmonths+0x2bb>
cmpq   $0x0,-0x10(%rbp)
je     14a6 <tm_diffmonths+0x356>
mov    -0x60(%rbp),%rdi
mov    -0x44(%rbp),%esi
call   1050 <tm_addmonths@plt>
mov    -0x60(%rbp),%rcx
mov    -0x58(%rbp),%rax
mov    -0x1c(%rbp),%edx
mov    %edx,-0x64(%rbp)
mov    -0x18(%rbp),%rdi
mov    (%rcx),%rdx
mov    %rdx,(%rsp)
mov    0x8(%rcx),%rdx
mov    %rdx,0x8(%rsp)
mov    0x10(%rcx),%rdx
mov    %rdx,0x10(%rsp)
mov    0x18(%rcx),%rcx
mov    %rcx,0x18(%rsp)
mov    (%rax),%rcx
mov    %rcx,0x20(%rsp)
mov    0x8(%rax),%rcx
mov    %rcx,0x28(%rsp)
mov    0x10(%rax),%rcx
mov    %rcx,0x30(%rsp)
mov    0x18(%rax),%rax
mov    %rax,0x38(%rsp)
call   1060 <tm_diffdays@plt>
mov    -0x64(%rbp),%ecx
imul   %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     14a1 <tm_diffmonths+0x351>
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
imul   (%rax),%ecx
mov    %ecx,(%rax)
jmp    14a6 <tm_diffmonths+0x356>
mov    -0x1c(%rbp),%eax
imul   -0x44(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tm_diffmonths>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%r15
mov    %rdi,%r14
movaps 0xa0(%rsp),%xmm0
movaps 0xb0(%rsp),%xmm1
movups %xmm1,0x10(%rsp)
movups %xmm0,(%rsp)
call   1040 <tm_getrepresentation@plt>
mov    %rax,%rbx
movaps 0xc0(%rsp),%xmm0
movaps 0xd0(%rsp),%xmm1
movups %xmm1,0x10(%rsp)
movups %xmm0,(%rsp)
call   1040 <tm_getrepresentation@plt>
cmp    %rax,%rbx
jne    126d <tm_diffmonths+0x11d>
lea    0xc0(%rsp),%r12
lea    0xa0(%rsp),%rbx
movups (%r12),%xmm0
movups 0x10(%r12),%xmm1
movups %xmm1,0x30(%rsp)
movups %xmm0,0x20(%rsp)
movups (%rbx),%xmm0
movups 0x10(%rbx),%xmm1
movups %xmm1,0x10(%rsp)
movups %xmm0,(%rsp)
call   1030 <tm_diffseconds@plt>
mov    $0x1,%r13d
test   %rax,%rax
jns    122f <tm_diffmonths+0xdf>
movups (%rbx),%xmm0
movups 0x10(%rbx),%xmm1
movaps %xmm1,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movups (%r12),%xmm0
movups 0x10(%r12),%xmm1
movups %xmm1,0x10(%rbx)
movups %xmm0,(%rbx)
movaps 0x40(%rsp),%xmm0
movaps 0x50(%rsp),%xmm1
movups %xmm1,0x10(%r12)
movups %xmm0,(%r12)
mov    $0xffffffff,%r13d
movups (%r12),%xmm0
movups 0x10(%r12),%xmm1
movups %xmm1,0x30(%rsp)
movups %xmm0,0x20(%rsp)
movups (%rbx),%xmm0
movups 0x10(%rbx),%xmm1
movups %xmm1,0x10(%rsp)
movups %xmm0,(%rsp)
call   1070 <tm_diffcalendarmonths@plt>
mov    %eax,%ebp
mov    (%rbx),%rax
cmp    %rax,(%r12)
jge    1286 <tm_diffmonths+0x136>
test   %ebp,%ebp
jle    12b6 <tm_diffmonths+0x166>
add    $0xffffffff,%ebp
jmp    12b6 <tm_diffmonths+0x166>
mov    0x2d64(%rip),%rax
mov    (%rax),%eax
mov    0x2d63(%rip),%rcx
mov    %eax,(%rcx)
xor    %ebp,%ebp
jmp    130c <tm_diffmonths+0x1bc>
jne    12b6 <tm_diffmonths+0x166>
mov    0x8(%rbx),%rax
cmp    %rax,0x8(%r12)
jl     1264 <tm_diffmonths+0x114>
jne    12b6 <tm_diffmonths+0x166>
mov    0x10(%r12),%rax
cmp    0x10(%rbx),%rax
jl     1264 <tm_diffmonths+0x114>
mov    0x10(%r12),%rax
cmp    0x10(%rbx),%rax
jne    12b6 <tm_diffmonths+0x166>
mov    0x18(%r12),%rax
cmp    0x18(%rbx),%rax
jl     1264 <tm_diffmonths+0x114>
test   %r14,%r14
je     1308 <tm_diffmonths+0x1b8>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1050 <tm_addmonths@plt>
movups (%r12),%xmm0
movups 0x10(%r12),%xmm1
movups %xmm1,0x30(%rsp)
movups %xmm0,0x20(%rsp)
movups (%rbx),%xmm0
movups 0x10(%rbx),%xmm1
movups %xmm1,0x10(%rsp)
movups %xmm0,(%rsp)
mov    %r15,%rdi
call   1060 <tm_diffdays@plt>
imul   %r13d,%eax
mov    %eax,(%r14)
test   %r15,%r15
je     1308 <tm_diffmonths+0x1b8>
mov    (%r15),%eax
imul   %r13d,%eax
mov    %eax,(%r15)
imul   %r13d,%ebp
mov    %ebp,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i64, i64, i64, i64 }
@EINVAL = global i32 0
@errno = global i32 0
define i32 @tm_diffmonths(%struct.tm* byval(%struct.tm) align 8 %0, %struct.tm* byval(%struct.tm) align 8 %1, i32* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca %struct.tm
%10 = alloca i32
store i32* %2, i32** %6
store i32* %3, i32** %7
%11 = call i64 @tm_getrepresentation(%struct.tm* byval(%struct.tm) align 8 %0)
%12 = call i64 @tm_getrepresentation(%struct.tm* byval(%struct.tm) align 8 %1)
%13 = icmp ne i64 %11, %12
br i1 %13, label %14, label %16
14: ; preds = %4
%15 = load i32, i32* @EINVAL
store i32 %15, i32* @errno
store i32 0, i32* %5
br label %117
16: ; preds = %4
store i32 1, i32* %8
%17 = call i64 @tm_diffseconds(%struct.tm* byval(%struct.tm) align 8 %0, %struct.tm* byval(%struct.tm) align 8 %1)
%18 = icmp slt i64 %17, 0
br i1 %18, label %19, label %26
19: ; preds = %16
%20 = bitcast %struct.tm* %9 to i8*
%21 = bitcast %struct.tm* %0 to i8*
%22 = bitcast %struct.tm* %0 to i8*
%23 = bitcast %struct.tm* %1 to i8*
%24 = bitcast %struct.tm* %1 to i8*
%25 = bitcast %struct.tm* %9 to i8*
store i32 -1, i32* %8
br label %26
26: ; preds = %19, %16
%27 = call i32 @tm_diffcalendarmonths(%struct.tm* byval(%struct.tm) align 8 %0, %struct.tm* byval(%struct.tm) align 8 %1)
store i32 %27, i32* %10
%28 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 0
%29 = load i64, i64* %28
%30 = getelementptr inbounds %struct.tm, %struct.tm* %0, i32 0, i32 0
%31 = load i64, i64* %30
%32 = icmp slt i64 %29, %31
br i1 %32, label %87, label %33
33: ; preds = %26
%34 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 0
%35 = load i64, i64* %34
%36 = getelementptr inbounds %struct.tm, %struct.tm* %0, i32 0, i32 0
%37 = load i64, i64* %36
%38 = icmp eq i64 %35, %37
br i1 %38, label %39, label %45
39: ; preds = %33
%40 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 1
%41 = load i64, i64* %40
%42 = getelementptr inbounds %struct.tm, %struct.tm* %0, i32 0, i32 1
%43 = load i64, i64* %42
%44 = icmp slt i64 %41, %43
br i1 %44, label %87, label %45
45: ; preds = %39, %33
%46 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 0
%47 = load i64, i64* %46
%48 = getelementptr inbounds %struct.tm, %struct.tm* %0, i32 0, i32 0
%49 = load i64, i64* %48
%50 = icmp eq i64 %47, %49
br i1 %50, label %51, label %63
51: ; preds = %45
%52 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 1
%53 = load i64, i64* %52
%54 = getelementptr inbounds %struct.tm, %struct.tm* %0, i32 0, i32 1
%55 = load i64, i64* %54
%56 = icmp eq i64 %53, %55
br i1 %56, label %57, label %63
57: ; preds = %51
%58 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 2
%59 = load i64, i64* %58
%60 = getelementptr inbounds %struct.tm, %struct.tm* %0, i32 0, i32 2
%61 = load i64, i64* %60
%62 = icmp slt i64 %59, %61
br i1 %62, label %87, label %63
63: ; preds = %57, %51, %45
%64 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 0
%65 = load i64, i64* %64
%66 = getelementptr inbounds %struct.tm, %struct.tm* %0, i32 0, i32 0
%67 = load i64, i64* %66
%68 = icmp eq i64 %65, %67
br i1 %68, label %69, label %94
69: ; preds = %63
%70 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 1
%71 = load i64, i64* %70
%72 = getelementptr inbounds %struct.tm, %struct.tm* %0, i32 0, i32 1
%73 = load i64, i64* %72
%74 = icmp eq i64 %71, %73
br i1 %74, label %75, label %94
75: ; preds = %69
%76 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 2
%77 = load i64, i64* %76
%78 = getelementptr inbounds %struct.tm, %struct.tm* %0, i32 0, i32 2
%79 = load i64, i64* %78
%80 = icmp eq i64 %77, %79
br i1 %80, label %81, label %94
81: ; preds = %75
%82 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 3
%83 = load i64, i64* %82
%84 = getelementptr inbounds %struct.tm, %struct.tm* %0, i32 0, i32 3
%85 = load i64, i64* %84
%86 = icmp slt i64 %83, %85
br i1 %86, label %87, label %94
87: ; preds = %81, %57, %39, %26
%88 = load i32, i32* %10
%89 = icmp sgt i32 %88, 0
br i1 %89, label %90, label %93
90: ; preds = %87
%91 = load i32, i32* %10
%92 = add nsw i32 %91, -1
store i32 %92, i32* %10
br label %93
93: ; preds = %90, %87
br label %94
94: ; preds = %93, %81, %75, %69, %63
%95 = load i32*, i32** %6
%96 = icmp ne i32* %95, null
br i1 %96, label %97, label %113
97: ; preds = %94
%98 = load i32, i32* %10
%99 = call i32 @tm_addmonths(%struct.tm* %0, i32 %98)
%100 = load i32, i32* %8
%101 = load i32*, i32** %7
%102 = call i32 @tm_diffdays(%struct.tm* byval(%struct.tm) align 8 %0, %struct.tm* byval(%struct.tm) align 8 %1, i32* %101)
%103 = mul nsw i32 %100, %102
%104 = load i32*, i32** %6
store i32 %103, i32* %104
%105 = load i32*, i32** %7
%106 = icmp ne i32* %105, null
br i1 %106, label %107, label %112
107: ; preds = %97
%108 = load i32, i32* %8
%109 = load i32*, i32** %7
%110 = load i32, i32* %109
%111 = mul nsw i32 %110, %108
store i32 %111, i32* %109
br label %112
112: ; preds = %107, %97
br label %113
113: ; preds = %112, %94
%114 = load i32, i32* %8
%115 = load i32, i32* %10
%116 = mul nsw i32 %114, %115
store i32 %116, i32* %5
br label %117
117: ; preds = %113, %14
%118 = load i32, i32* %5
ret i32 %118
}

LLVM IR (-O2):
%struct.tm = type { i64, i64, i64, i64 }
@EINVAL = global i32 0
@errno = global i32 0
define i32 @tm_diffmonths(%struct.tm* byval(%struct.tm) align 8 %0, %struct.tm* byval(%struct.tm) align 8 %1, i32* writeonly %2, i32* %3) {
%5 = alloca %struct.tm
%6 = tail call i64 @tm_getrepresentation(%struct.tm* byval(%struct.tm) align 8 %0)
%7 = tail call i64 @tm_getrepresentation(%struct.tm* byval(%struct.tm) align 8 %1)
%8 = icmp eq i64 %6, %7
br i1 %8, label %11, label %9
9: ; preds = %4
%10 = load i32, i32* @EINVAL
store i32 %10, i32* @errno
br label %73
11: ; preds = %4
%12 = tail call i64 @tm_diffseconds(%struct.tm* byval(%struct.tm) align 8 %0, %struct.tm* byval(%struct.tm) align 8 %1)
%13 = icmp slt i64 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %11
%15 = bitcast %struct.tm* %5 to i8*
%16 = bitcast %struct.tm* %0 to i8*
%17 = bitcast %struct.tm* %1 to i8*
br label %18
18: ; preds = %14, %11
%19 = phi i32 [ -1, %14 ], [ 1, %11 ]
%20 = tail call i32 @tm_diffcalendarmonths(%struct.tm* byval(%struct.tm) align 8 %0, %struct.tm* byval(%struct.tm) align 8 %1)
%21 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 0
%22 = load i64, i64* %21
%23 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 0
%24 = load i64, i64* %23
%25 = icmp slt i64 %22, %24
br i1 %25, label %56, label %26
26: ; preds = %18
%27 = icmp eq i64 %22, %24
br i1 %27, label %28, label %60
28: ; preds = %26
%29 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 1
%30 = load i64, i64* %29
%31 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 1
%32 = load i64, i64* %31
%33 = icmp slt i64 %30, %32
br i1 %33, label %56, label %34
34: ; preds = %28
%35 = icmp eq i64 %30, %32
br i1 %35, label %36, label %60
36: ; preds = %34
%37 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 2
%38 = load i64, i64* %37
%39 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 2
%40 = load i64, i64* %39
%41 = icmp slt i64 %38, %40
br i1 %41, label %56, label %42
42: ; preds = %36
%43 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 2
%44 = load i64, i64* %43
%45 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 2
%46 = load i64, i64* %45
%47 = icmp eq i64 %44, %46
br i1 %47, label %48, label %60
48: ; preds = %42
%49 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 3
%50 = load i64, i64* %49
%51 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 3
%52 = load i64, i64* %51
%53 = icmp slt i64 %50, %52
%54 = icmp sgt i32 %20, 0
%55 = select i1 %53, i1 %54, i1 false
br i1 %55, label %58, label %60
56: ; preds = %36, %28, %18
%57 = icmp sgt i32 %20, 0
br i1 %57, label %58, label %60
58: ; preds = %48, %56
%59 = add nsw i32 %20, -1
br label %60
60: ; preds = %34, %26, %56, %58, %48, %42
%61 = phi i32 [ %59, %58 ], [ %20, %56 ], [ %20, %48 ], [ %20, %42 ], [ %20, %26 ], [ %20, %34 ]
%62 = icmp eq i32* %2, null
br i1 %62, label %71, label %63
63: ; preds = %60
%64 = call i32 @tm_addmonths(%struct.tm* %0, i32 %61)
%65 = call i32 @tm_diffdays(%struct.tm* byval(%struct.tm) align 8 %0, %struct.tm* byval(%struct.tm) align 8 %1, i32* %3)
%66 = mul nsw i32 %65, %19
store i32 %66, i32* %2
%67 = icmp eq i32* %3, null
br i1 %67, label %71, label %68
68: ; preds = %63
%69 = load i32, i32* %3
%70 = mul nsw i32 %69, %19
store i32 %70, i32* %3
br label %71
71: ; preds = %63, %68, %60
%72 = mul nsw i32 %61, %19
br label %73
73: ; preds = %71, %9
%74 = phi i32 [ 0, %9 ], [ %72, %71 ]
ret i32 %74
}