#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*/ print_batt(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ println();
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int dd0, mm0, yy0, dd1, mm1, yy1;
  printf("Enter your Date of birth: (DD/MM/YYYY):\n");
  printf("Date:");
  scanf("%d", &dd0);
  printf("Month:");
  scanf("%d", &mm0);
  printf("Year:");
  scanf("%d", &yy0);
  printf("Enter Today's Date: (DD/MM/YYYY):\n");
  printf("Date:");
  scanf("%d", &dd1);
  printf("Month:");
  scanf("%d", &mm1);
  printf("Year:");
  scanf("%d", &yy1);
  println();
  int diff = (yy1 * 365 + mm1 * 30 + dd1) - (yy0 * 365 + mm0 * 30 + dd0);
  int avg_life_exp_nepal = 67;
  int ref_val = avg_life_exp_nepal * 365;
  int rem_days = ref_val - diff;
  printf("Total Remaining Days: %d\n", rem_days);
  int rem_yy = rem_days / 365;
  printf("Rem Years: %d\n", rem_yy);
  int rem_mm = (rem_days - (rem_yy * 365)) / 30;
  printf("Rem Months: %d\n", rem_mm);
  int rem_dd = rem_days - ((rem_yy * 365) + (rem_mm * 30));
  printf("Rem Days: %d\n", rem_dd);
  float percent = ((float)rem_days / (float)ref_val) * 100;
  println();
  printf("Percentage Remaining : %f \n", percent);
  println();
  print_batt((int)percent);
  println();
  printf("A word of advice: Use your time wisely!\n");
  println();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea3(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe85(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe59(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe3b(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe1d(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1050 <scanf@plt>
mov    $0x0,%al
call   1040 <println@plt>
imul   $0x16d,-0x1c(%rbp),%eax
imul   $0x1e,-0x18(%rbp),%ecx
add    %ecx,%eax
add    -0x14(%rbp),%eax
imul   $0x16d,-0x10(%rbp),%ecx
imul   $0x1e,-0xc(%rbp),%edx
add    %edx,%ecx
add    -0x8(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x20(%rbp)
movl   $0x43,-0x24(%rbp)
imul   $0x16d,-0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
sub    -0x20(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%esi
lea    0xdf7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
mov    $0x16d,%ecx
cltd
idiv   %ecx
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%esi
lea    0xdf2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
imul   $0x16d,-0x30(%rbp),%ecx
sub    %ecx,%eax
mov    $0x1e,%ecx
cltd
idiv   %ecx
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%esi
lea    0xdd9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
imul   $0x16d,-0x30(%rbp),%ecx
imul   $0x1e,-0x34(%rbp),%edx
add    %edx,%ecx
sub    %ecx,%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%esi
lea    0xdc3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cvtsi2ssl -0x2c(%rbp),%xmm0
cvtsi2ssl -0x28(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  0xd07(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x3c(%rbp)
mov    $0x0,%al
call   1040 <println@plt>
movss  -0x3c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd94(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <println@plt>
cvttss2si -0x3c(%rbp),%edi
call   1060 <print_batt@plt>
mov    $0x0,%al
call   1040 <println@plt>
lea    0xd8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <println@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xf1f(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9a(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe8f(%rip),%rbx
lea    0x24(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xe7e(%rip),%r15
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xe67(%rip),%r12
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xeda(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
xor    %eax,%eax
call   1050 <println@plt>
mov    0x1c(%rsp),%eax
mov    0x20(%rsp),%ecx
sub    0x14(%rsp),%ecx
mov    0x24(%rsp),%edx
mov    %ecx,%esi
shl    $0x5,%esi
sub    %ecx,%esi
sub    %ecx,%esi
sub    0x10(%rsp),%eax
sub    0x18(%rsp),%edx
imul   $0x16d,%eax,%eax
add    %eax,%edx
lea    (%rsi,%rdx,1),%ebx
add    $0x5f87,%ebx
mov    %edx,%r15d
add    %esi,%r15d
lea    0xdbf(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movslq %ebx,%r14
imul   $0xffffffffb38cf9b1,%r14,%rax
shr    $0x20,%rax
lea    (%rax,%r15,1),%ebx
add    $0x5f87,%ebx
mov    %ebx,%eax
shr    $0x1f,%eax
sar    $0x8,%ebx
add    %eax,%ebx
lea    0xda7(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
imul   $0xfffffe93,%ebx,%eax
add    %r15d,%eax
add    $0x5f87,%eax
movslq %eax,%r15
imul   $0xffffffff88888889,%r15,%rbx
shr    $0x20,%rbx
add    %r15d,%ebx
mov    %ebx,%eax
shr    $0x1f,%eax
sar    $0x4,%ebx
add    %eax,%ebx
lea    0xd7d(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
imul   $0xffffffe2,%ebx,%esi
add    %r15d,%esi
lea    0xd77(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cvtsi2ss %r14d,%xmm0
divss  0xd0c(%rip),%xmm0
mulss  0xd08(%rip),%xmm0
movss  %xmm0,0xc(%rsp)
xor    %eax,%eax
call   1050 <println@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd4b(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <println@plt>
cvttss2si 0xc(%rsp),%edi
call   1070 <print_batt@plt>
xor    %eax,%eax
call   1050 <println@plt>
lea    0xd8a(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <println@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [41 x i8] c"Enter your Date of birth: (DD/MM/YYYY):\0A\00"
@.str.1 = [6 x i8] c"Date:\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [7 x i8] c"Month:\00"
@.str.4 = [6 x i8] c"Year:\00"
@.str.5 = [35 x i8] c"Enter Today's Date: (DD/MM/YYYY):\0A\00"
@.str.6 = [26 x i8] c"Total Remaining Days: %d\0A\00"
@.str.7 = [15 x i8] c"Rem Years: %d\0A\00"
@.str.8 = [16 x i8] c"Rem Months: %d\0A\00"
@.str.9 = [14 x i8] c"Rem Days: %d\0A\00"
@.str.10 = [28 x i8] c"Percentage Remaining : %f \0A\00"
@.str.11 = [41 x i8] c"A word of advice: Use your time wisely!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca float
store i32 0, i32* %1
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0))
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%25 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%27 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %6)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%29 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %7)
%30 = call i32 (...) @println()
%31 = load i32, i32* %7
%32 = mul nsw i32 %31, 365
%33 = load i32, i32* %6
%34 = mul nsw i32 %33, 30
%35 = add nsw i32 %32, %34
%36 = load i32, i32* %5
%37 = add nsw i32 %35, %36
%38 = load i32, i32* %4
%39 = mul nsw i32 %38, 365
%40 = load i32, i32* %3
%41 = mul nsw i32 %40, 30
%42 = add nsw i32 %39, %41
%43 = load i32, i32* %2
%44 = add nsw i32 %42, %43
%45 = sub nsw i32 %37, %44
store i32 %45, i32* %8
store i32 67, i32* %9
%46 = load i32, i32* %9
%47 = mul nsw i32 %46, 365
store i32 %47, i32* %10
%48 = load i32, i32* %10
%49 = load i32, i32* %8
%50 = sub nsw i32 %48, %49
store i32 %50, i32* %11
%51 = load i32, i32* %11
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i32 %51)
%53 = load i32, i32* %11
%54 = sdiv i32 %53, 365
store i32 %54, i32* %12
%55 = load i32, i32* %12
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i32 %55)
%57 = load i32, i32* %11
%58 = load i32, i32* %12
%59 = mul nsw i32 %58, 365
%60 = sub nsw i32 %57, %59
%61 = sdiv i32 %60, 30
store i32 %61, i32* %13
%62 = load i32, i32* %13
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i32 %62)
%64 = load i32, i32* %11
%65 = load i32, i32* %12
%66 = mul nsw i32 %65, 365
%67 = load i32, i32* %13
%68 = mul nsw i32 %67, 30
%69 = add nsw i32 %66, %68
%70 = sub nsw i32 %64, %69
store i32 %70, i32* %14
%71 = load i32, i32* %14
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i32 %71)
%73 = load i32, i32* %11
%74 = sitofp i32 %73 to float
%75 = load i32, i32* %10
%76 = sitofp i32 %75 to float
%77 = fdiv float %74, %76
%78 = fmul float %77, 1.000000e+02
store float %78, float* %15
%79 = call i32 (...) @println()
%80 = load float, float* %15
%81 = fpext float %80 to double
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.10, i64 0, i64 0), double %81)
%83 = call i32 (...) @println()
%84 = load float, float* %15
%85 = fptosi float %84 to i32
%86 = call i32 @print_batt(i32 %85)
%87 = call i32 (...) @println()
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.11, i64 0, i64 0))
%89 = call i32 (...) @println()
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"Date:\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [7 x i8] c"Month:\00"
@.str.4 = [6 x i8] c"Year:\00"
@.str.6 = [26 x i8] c"Total Remaining Days: %d\0A\00"
@.str.7 = [15 x i8] c"Rem Years: %d\0A\00"
@.str.8 = [16 x i8] c"Rem Months: %d\0A\00"
@.str.9 = [14 x i8] c"Rem Days: %d\0A\00"
@.str.10 = [28 x i8] c"Percentage Remaining : %f \0A\00"
@str = [40 x i8] c"Enter your Date of birth: (DD/MM/YYYY):\00"
@str.12 = [34 x i8] c"Enter Today's Date: (DD/MM/YYYY):\00"
@str.13 = [40 x i8] c"A word of advice: Use your time wisely!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %1 to i8*
%8 = bitcast i32* %2 to i8*
%9 = bitcast i32* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = bitcast i32* %5 to i8*
%12 = bitcast i32* %6 to i8*
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.12, i64 0, i64 0))
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %6)
%27 = call i32 (...) @println()
%28 = load i32, i32* %6
%29 = load i32, i32* %5
%30 = load i32, i32* %4
%31 = load i32, i32* %3
%32 = load i32, i32* %2
%33 = load i32, i32* %1
%34 = sub i32 %32, %29
%35 = mul i32 %34, 30
%36 = sub i32 %31, %28
%37 = mul i32 %36, 365
%38 = sub i32 24455, %30
%39 = add i32 %38, %33
%40 = add i32 %39, %37
%41 = add i32 %40, %35
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i32 %41)
%43 = sdiv i32 %41, 365
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i32 %43)
%45 = mul nsw i32 %43, -365
%46 = add i32 %45, %41
%47 = sdiv i32 %46, 30
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i32 %47)
%49 = mul nsw i32 %47, -30
%50 = add i32 %46, %49
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i32 %50)
%52 = sitofp i32 %41 to float
%53 = fdiv float %52, 2.445500e+04
%54 = fmul float %53, 1.000000e+02
%55 = call i32 (...) @println()
%56 = fpext float %54 to double
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.10, i64 0, i64 0), double %56)
%58 = call i32 (...) @println()
%59 = fptosi float %54 to i32
%60 = call i32 @print_batt(i32 %59)
%61 = call i32 (...) @println()
%62 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.13, i64 0, i64 0))
%63 = call i32 (...) @println()
ret i32 0
}