int yrCalc(long *totalDays, int *year, int *month, int *day) {
  printf("\n%d totalDays in yrCalc", totalDays);
  printf("\n%d", *year);
  printf("\n%d", *month);
  printf("\n%d", *day);
  *totalDays += 365 * (*year - 2001);
  *totalDays += 30 * (*month - 1);
  *totalDays += *day;
  return *totalDays;
}


x86 assembly (clang, -O0):
<yrCalc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
sub    $0x7d1,%eax
imul   $0x16d,%eax,%eax
movslq %eax,%rcx
mov    -0x8(%rbp),%rax
add    (%rax),%rcx
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
sub    $0x1,%eax
imul   $0x1e,%eax,%eax
movslq %eax,%rcx
mov    -0x8(%rbp),%rax
add    (%rax),%rcx
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
movslq (%rax),%rcx
mov    -0x8(%rbp),%rax
add    (%rax),%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yrCalc>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r12
lea    0xed4(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rbx),%esi
lea    0xed9(%rip),%r13
mov    %r13,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%r15),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%r14),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
imul   $0x16d,(%rbx),%eax
add    $0xfff4db03,%eax
cltq
add    (%r12),%rax
mov    (%r15),%ecx
mov    %ecx,%edx
shl    $0x5,%edx
sub    %ecx,%edx
sub    %ecx,%edx
add    $0xffffffe2,%edx
movslq %edx,%rcx
add    %rax,%rcx
movslq (%r14),%rax
add    %rcx,%rax
mov    %rax,(%r12)
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [24 x i8] c"\0A%d totalDays in yrCalc\00"
@.str.1 = [4 x i8] c"\0A%d\00"
define i32 @yrCalc(i64* %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i64*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
store i64* %0, i64** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%9 = load i64*, i64** %5
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i64* %9)
%11 = load i32*, i32** %6
%12 = load i32, i32* %11
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = load i32*, i32** %7
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = load i32*, i32** %8
%18 = load i32, i32* %17
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = load i32*, i32** %6
%21 = load i32, i32* %20
%22 = sub nsw i32 %21, 2001
%23 = mul nsw i32 365, %22
%24 = sext i32 %23 to i64
%25 = load i64*, i64** %5
%26 = load i64, i64* %25
%27 = add nsw i64 %26, %24
store i64 %27, i64* %25
%28 = load i32*, i32** %7
%29 = load i32, i32* %28
%30 = sub nsw i32 %29, 1
%31 = mul nsw i32 30, %30
%32 = sext i32 %31 to i64
%33 = load i64*, i64** %5
%34 = load i64, i64* %33
%35 = add nsw i64 %34, %32
store i64 %35, i64* %33
%36 = load i32*, i32** %8
%37 = load i32, i32* %36
%38 = sext i32 %37 to i64
%39 = load i64*, i64** %5
%40 = load i64, i64* %39
%41 = add nsw i64 %40, %38
store i64 %41, i64* %39
%42 = load i64*, i64** %5
%43 = load i64, i64* %42
%44 = trunc i64 %43 to i32
ret i32 %44
}

LLVM IR (-O2):
@.str = [24 x i8] c"\0A%d totalDays in yrCalc\00"
@.str.1 = [4 x i8] c"\0A%d\00"
define i32 @yrCalc(i64* %0, i32* nocapture %1, i32* nocapture %2, i32* nocapture %3) {
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i64* %0)
%6 = load i32, i32* %1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = load i32, i32* %2
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = load i32, i32* %3
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %1
%13 = mul i32 %12, 365
%14 = add i32 %13, -730365
%15 = sext i32 %14 to i64
%16 = load i64, i64* %0
%17 = add nsw i64 %16, %15
%18 = load i32, i32* %2
%19 = mul i32 %18, 30
%20 = add i32 %19, -30
%21 = sext i32 %20 to i64
%22 = add nsw i64 %17, %21
%23 = load i32, i32* %3
%24 = sext i32 %23 to i64
%25 = add nsw i64 %22, %24
store i64 %25, i64* %0
%26 = trunc i64 %25 to i32
ret i32 %26
}