#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 LateByDays(char *, char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
double CalculatePoints(char *duedt, char *subdt, double pts1) {
  int lateDays = LateByDays(duedt, subdt);
  if (lateDays < 0) {
    printf("\nYou done goofed! Bad input!\n");
    exit(0);
  }
  if (lateDays <= 5) {
    return (pts1 - 10.0 * lateDays);
  } else {
    return 0.0;
  }
}


x86 assembly (clang, -O0):
<CalculatePoints>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <LateByDays@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    1172 <CalculatePoints+0x42>
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>
cmpl   $0x5,-0x24(%rbp)
jg     11a0 <CalculatePoints+0x70>
movsd  -0x20(%rbp),%xmm1
cvtsi2sdl -0x24(%rbp),%xmm0
movsd  0xe72(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11a8 <CalculatePoints+0x78>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CalculatePoints>:
push   %rax
movsd  %xmm0,(%rsp)
call   1040 <LateByDays@plt>
test   %eax,%eax
js     115f <CalculatePoints+0x2f>
cmp    $0x6,%eax
jb     1149 <CalculatePoints+0x19>
xorps  %xmm0,%xmm0
pop    %rax
ret
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xea8(%rip),%xmm0
addsd  (%rsp),%xmm0
pop    %rax
ret
lea    0xea2(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"\0AYou done goofed! Bad input!\0A\00"
define double @CalculatePoints(i8* %0, i8* %1, double %2) {
%4 = alloca double
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca double
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store double %2, double* %7
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = call i32 @LateByDays(i8* %9, i8* %10)
store i32 %11, i32* %8
%12 = load i32, i32* %8
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %3
%15 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @exit(i32 0)
unreachable
17: ; preds = %3
%18 = load i32, i32* %8
%19 = icmp sle i32 %18, 5
br i1 %19, label %20, label %25
20: ; preds = %17
%21 = load double, double* %7
%22 = load i32, i32* %8
%23 = sitofp i32 %22 to double
%24 = call double @llvm.fmuladd.f64(double -1.000000e+01, double %23, double %21)
store double %24, double* %4
br label %26
25: ; preds = %17
store double 0.000000e+00, double* %4
br label %26
26: ; preds = %25, %20
%27 = load double, double* %4
ret double %27
}

LLVM IR (-O2):
@str = [29 x i8] c"\0AYou done goofed! Bad input!\00"
define double @CalculatePoints(i8* %0, i8* %1, double %2) {
%4 = tail call i32 @LateByDays(i8* %0, i8* %1)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 0)
unreachable
9: ; preds = %3
%10 = icmp ult i32 %4, 6
%11 = sitofp i32 %4 to double
%12 = tail call double @llvm.fmuladd.f64(double %11, double -1.000000e+01, double %2)
%13 = select i1 %10, double %12, double 0.000000e+00
ret double %13
}