#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 */
int /*<<< orphan*/ printf(char *, ...);
int getLeapYears_Num(int currentYear) {
  printf("\nPrinting Leap Years Since 1970 ...... \n \t");
  int leapYears_Num = 0;
  for (int i = 0; i <= (currentYear - 1970); i++) {
    if (((1970 + i) % 4 == 0) && ((1970 + i) % 100 != 0) ||
        ((1970 + i) % 400 == 0)) {
      leapYears_Num++;
      printf("%d ", 1970 + i);
    }
  }
  return leapYears_Num;
}


x86 assembly (clang, -O0):
<getLeapYears_Num>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x7b2,%ecx
cmp    %ecx,%eax
jg     11c9 <getLeapYears_Num+0xb9>
mov    -0xc(%rbp),%eax
add    $0x7b2,%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    117d <getLeapYears_Num+0x6d>
mov    -0xc(%rbp),%eax
add    $0x7b2,%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1196 <getLeapYears_Num+0x86>
mov    -0xc(%rbp),%eax
add    $0x7b2,%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11b6 <getLeapYears_Num+0xa6>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%esi
add    $0x7b2,%esi
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11bb <getLeapYears_Num+0xab>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1137 <getLeapYears_Num+0x27>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getLeapYears_Num>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%r15d
lea    0xedf(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <printf@plt>
cmp    $0x7b2,%r15d
jge    1140 <getLeapYears_Num+0x30>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
neg    %r15d
mov    $0x7b2,%ebx
lea    0xedc(%rip),%r14
xor    %ebp,%ebp
jmp    1182 <getLeapYears_Num+0x72>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%ebp
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    (%r15,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
je     1133 <getLeapYears_Num+0x23>
mov    %ebx,%eax
imul   $0x51eb851f,%rax,%rax
mov    %rax,%rcx
shr    $0x25,%rcx
imul   $0x64,%ecx,%ecx
test   $0x3,%bl
sete   %dl
cmp    %ecx,%ebx
setne  %cl
test   %cl,%dl
jne    1160 <getLeapYears_Num+0x50>
shr    $0x27,%rax
imul   $0x190,%eax,%eax
neg    %eax
add    %ebx,%eax
add    $0x7b2,%eax
cmp    $0x7b2,%eax
jne    116f <getLeapYears_Num+0x5f>
jmp    1160 <getLeapYears_Num+0x50>

LLVM IR (-O0):
@.str = [43 x i8] c"\0APrinting Leap Years Since 1970 ...... \0A \09\00"
@.str.1 = [4 x i8] c"%d \00"
define i32 @getLeapYears_Num(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
store i32 0, i32* %4
br label %6
6: ; preds = %33, %1
%7 = load i32, i32* %4
%8 = load i32, i32* %2
%9 = sub nsw i32 %8, 1970
%10 = icmp sle i32 %7, %9
br i1 %10, label %11, label %36
11: ; preds = %6
%12 = load i32, i32* %4
%13 = add nsw i32 1970, %12
%14 = srem i32 %13, 4
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %11
%17 = load i32, i32* %4
%18 = add nsw i32 1970, %17
%19 = srem i32 %18, 100
%20 = icmp ne i32 %19, 0
br i1 %20, label %26, label %21
21: ; preds = %16, %11
%22 = load i32, i32* %4
%23 = add nsw i32 1970, %22
%24 = srem i32 %23, 400
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %32
26: ; preds = %21, %16
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
%29 = load i32, i32* %4
%30 = add nsw i32 1970, %29
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %26, %21
br label %33
33: ; preds = %32
%34 = load i32, i32* %4
%35 = add nsw i32 %34, 1
store i32 %35, i32* %4
br label %6
36: ; preds = %6
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
@.str = [43 x i8] c"\0APrinting Leap Years Since 1970 ...... \0A \09\00"
@.str.1 = [4 x i8] c"%d \00"
define i32 @getLeapYears_Num(i32 %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%3 = icmp slt i32 %0, 1970
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = add nsw i32 %0, -1969
br label %8
6: ; preds = %23, %1
%7 = phi i32 [ 0, %1 ], [ %24, %23 ]
ret i32 %7
8: ; preds = %4, %23
%9 = phi i32 [ %25, %23 ], [ 0, %4 ]
%10 = phi i32 [ %24, %23 ], [ 0, %4 ]
%11 = add nuw nsw i32 %9, 1970
%12 = and i32 %11, 3
%13 = icmp eq i32 %12, 0
%14 = urem i32 %11, 100
%15 = icmp ne i32 %14, 0
%16 = and i1 %13, %15
%17 = urem i32 %11, 400
%18 = icmp eq i32 %17, 0
%19 = select i1 %16, i1 true, i1 %18
br i1 %19, label %20, label %23
20: ; preds = %8
%21 = add nsw i32 %10, 1
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %11)
br label %23
23: ; preds = %8, %20
%24 = phi i32 [ %21, %20 ], [ %10, %8 ]
%25 = add nuw i32 %9, 1
%26 = icmp eq i32 %25, %5
br i1 %26, label %6, label %8
}