#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 tm_mday;
  int tm_mon;
  int tm_year;
  int /*<<< orphan*/ member_0;
};

/* Variables and functions */
int CalculateDaysBetween(struct tm *, struct tm *);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, int, char *, char *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int main(void) {
  struct tm dateinfo1 = {0, .tm_mday = 2, .tm_mon = 6, .tm_year = 2005};
  struct tm dateinfo2 = {0, .tm_mday = 16, .tm_mon = 6, .tm_year = 2005};
  int days = CalculateDaysBetween(&dateinfo1, &dateinfo2);
  char dateinfo1_cstr[32] = {0};
  strftime(dateinfo1_cstr, 32, "%d/%m/%y", &dateinfo1);
  char dateinfo2_cstr[32] = {0};
  strftime(dateinfo2_cstr, 32, "%d/%m/%y", &dateinfo2);
  printf("%d days have passed between %s and %s.\n", days, dateinfo1_cstr,
         dateinfo2_cstr);
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe9a(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xe97(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xe94(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xe91(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    -0x18(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1030 <CalculateDaysBetween@plt>
mov    %eax,-0x2c(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1050 <memset@plt>
lea    -0x50(%rbp),%rdi
mov    $0x20,%esi
lea    0xe65(%rip),%rdx
lea    -0x18(%rbp),%rcx
call   1070 <strftime@plt>
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1050 <memset@plt>
lea    -0x70(%rbp),%rdi
mov    $0x20,%esi
lea    0xe3c(%rip),%rdx
lea    -0x28(%rbp),%rcx
call   1070 <strftime@plt>
mov    -0x2c(%rbp),%esi
lea    -0x50(%rbp),%rdx
lea    -0x70(%rbp),%rcx
lea    0xe2a(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
movups 0xeab(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movups 0xeaf(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x10(%rsp),%r15
mov    %rsp,%r14
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <CalculateDaysBetween@plt>
mov    %eax,%ebp
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
lea    0xe92(%rip),%r13
lea    0x40(%rsp),%r12
mov    %r12,%rdi
mov    $0x20,%esi
mov    %r13,%rdx
mov    %r15,%rcx
call   1060 <strftime@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x20,%esi
mov    %r13,%rdx
mov    %r14,%rcx
call   1060 <strftime@plt>
lea    0xe57(%rip),%rdi
mov    %ebp,%esi
mov    %r12,%rdx
mov    %rbx,%rcx
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32 }
@__const.main.dateinfo1 = %struct.tm { i32 2, i32 6, i32 2005, i32 0 }
@__const.main.dateinfo2 = %struct.tm { i32 16, i32 6, i32 2005, i32 0 }
@.str = [9 x i8] c"%d/%m/%y\00"
@.str.1 = [40 x i8] c"%d days have passed between %s and %s.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.tm
%3 = alloca %struct.tm
%4 = alloca i32
%5 = alloca [32 x i8]
%6 = alloca [32 x i8]
store i32 0, i32* %1
%7 = bitcast %struct.tm* %2 to i8*
%8 = bitcast %struct.tm* %3 to i8*
%9 = call i32 @CalculateDaysBetween(%struct.tm* %2, %struct.tm* %3)
store i32 %9, i32* %4
%10 = bitcast [32 x i8]* %5 to i8*
%11 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%12 = call i32 @strftime(i8* %11, i32 32, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %struct.tm* %2)
%13 = bitcast [32 x i8]* %6 to i8*
%14 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%15 = call i32 @strftime(i8* %14, i32 32, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %struct.tm* %3)
%16 = load i32, i32* %4
%17 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%18 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%19 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 %16, i8* %17, i8* %18)
%20 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32 }
@__const.main.dateinfo1 = %struct.tm { i32 2, i32 6, i32 2005, i32 0 }
@__const.main.dateinfo2 = %struct.tm { i32 16, i32 6, i32 2005, i32 0 }
@.str = [9 x i8] c"%d/%m/%y\00"
@.str.1 = [40 x i8] c"%d days have passed between %s and %s.\0A\00"
define i32 @main() {
%1 = alloca %struct.tm
%2 = alloca %struct.tm
%3 = alloca [32 x i8]
%4 = alloca [32 x i8]
%5 = bitcast %struct.tm* %1 to i8*
%6 = bitcast %struct.tm* %2 to i8*
%7 = call i32 @CalculateDaysBetween(%struct.tm* %1, %struct.tm* %2)
%8 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%9 = call i32 @strftime(i8* %8, i32 32, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %struct.tm* %1)
%10 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%11 = call i32 @strftime(i8* %10, i32 32, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %struct.tm* %2)
%12 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 %7, i8* %8, i8* %10)
%13 = call i32 (...) @getchar()
ret i32 0
}