#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 */

/* Variables and functions */
scalar_t__ is_leap_year(int const);
int get_day_in_year_range(const int first_year, const int second_year) {
  if (first_year > second_year)
    return -1 * get_day_in_year_range(second_year, first_year);
  if (first_year == second_year || first_year + 1 == second_year)
    return 0;
  return (is_leap_year(first_year + 1) ? 366 : 365) +
         get_day_in_year_range(first_year + 1, second_year);
}


x86 assembly (clang, -O0):
<get_day_in_year_range>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1153 <get_day_in_year_range+0x33>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <get_day_in_year_range@plt>
imul   $0xffffffff,%eax,%eax
mov    %eax,-0x4(%rbp)
jmp    11b4 <get_day_in_year_range+0x94>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     116e <get_day_in_year_range+0x4e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
cmp    -0xc(%rbp),%eax
jne    117a <get_day_in_year_range+0x5a>
movl   $0x0,-0x4(%rbp)
jmp    11b4 <get_day_in_year_range+0x94>
mov    -0x8(%rbp),%edi
add    $0x1,%edi
call   1040 <is_leap_year@plt>
mov    %rax,%rdx
mov    $0x16d,%eax
mov    $0x16e,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
add    $0x1,%edi
mov    -0xc(%rbp),%esi
call   1030 <get_day_in_year_range@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_day_in_year_range>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebp
cmp    %esi,%edi
jle    113d <get_day_in_year_range+0x1d>
mov    %r14d,%edi
mov    %ebp,%esi
call   1030 <get_day_in_year_range@plt>
mov    %eax,%ebx
neg    %ebx
jmp    1144 <get_day_in_year_range+0x24>
xor    %ebx,%ebx
cmp    %r14d,%ebp
jne    114b <get_day_in_year_range+0x2b>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
add    $0x1,%ebp
xor    %ebx,%ebx
cmp    %ebp,%r14d
je     1144 <get_day_in_year_range+0x24>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebp,%edi
call   1040 <is_leap_year@plt>
cmp    $0x1,%rax
sbb    $0x0,%ebx
add    $0x16e,%ebx
add    $0x1,%ebp
cmp    %ebp,%r14d
jne    1160 <get_day_in_year_range+0x40>
jmp    1144 <get_day_in_year_range+0x24>

LLVM IR (-O0):
define i32 @get_day_in_year_range(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = load i32, i32* %5
%8 = icmp sgt i32 %6, %7
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i32, i32* %5
%11 = load i32, i32* %4
%12 = call i32 @get_day_in_year_range(i32 %10, i32 %11)
%13 = mul nsw i32 -1, %12
store i32 %13, i32* %3
br label %36
14: ; preds = %2
%15 = load i32, i32* %4
%16 = load i32, i32* %5
%17 = icmp eq i32 %15, %16
br i1 %17, label %23, label %18
18: ; preds = %14
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1
%21 = load i32, i32* %5
%22 = icmp eq i32 %20, %21
br i1 %22, label %23, label %24
23: ; preds = %18, %14
store i32 0, i32* %3
br label %36
24: ; preds = %18
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
%27 = call i64 @is_leap_year(i32 %26)
%28 = icmp ne i64 %27, 0
%29 = zext i1 %28 to i64
%30 = select i1 %28, i32 366, i32 365
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 1
%33 = load i32, i32* %5
%34 = call i32 @get_day_in_year_range(i32 %32, i32 %33)
%35 = add nsw i32 %30, %34
store i32 %35, i32* %3
br label %36
36: ; preds = %24, %23, %9
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
define i32 @get_day_in_year_range(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = icmp eq i32 %0, %1
br i1 %5, label %6, label %11
6: ; preds = %11, %4, %8
%7 = phi i32 [ %10, %8 ], [ 0, %4 ], [ %12, %11 ]
ret i32 %7
8: ; preds = %2
%9 = tail call i32 @get_day_in_year_range(i32 %1, i32 %0)
%10 = sub i32 0, %9
br label %6
11: ; preds = %4, %16
%12 = phi i32 [ %20, %16 ], [ 0, %4 ]
%13 = phi i32 [ %14, %16 ], [ %0, %4 ]
%14 = add nsw i32 %13, 1
%15 = icmp eq i32 %14, %1
br i1 %15, label %6, label %16
16: ; preds = %11
%17 = tail call i64 @is_leap_year(i32 %14)
%18 = icmp eq i64 %17, 0
%19 = select i1 %18, i32 365, i32 366
%20 = add nuw nsw i32 %19, %12
br label %11
}