#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) {
  printf("%s %s\n", duedt, subdt);
  int lateDays = LateByDays(duedt, subdt);
  printf("Late: %i\n", lateDays);
  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),%rsi
mov    -0x18(%rbp),%rdx
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <LateByDays@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x24(%rbp)
jge    119b <CalculatePoints+0x6b>
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>
cmpl   $0x5,-0x24(%rbp)
jg     11c9 <CalculatePoints+0x99>
movsd  -0x20(%rbp),%xmm1
cvtsi2sdl -0x24(%rbp),%xmm0
movsd  0xe49(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11d1 <CalculatePoints+0xa1>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CalculatePoints>:
push   %r14
push   %rbx
push   %rax
movsd  %xmm0,(%rsp)
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xeb2(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <LateByDays@plt>
mov    %eax,%ebx
lea    0xe98(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebx,%ebx
js     11ab <CalculatePoints+0x6b>
cmp    $0x6,%ebx
jb     118f <CalculatePoints+0x4f>
xorpd  %xmm0,%xmm0
jmp    11a3 <CalculatePoints+0x63>
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
mulsd  0xe62(%rip),%xmm0
addsd  (%rsp),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe67(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"%s %s\0A\00"
@.str.1 = [10 x i8] c"Late: %i\0A\00"
@.str.2 = [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 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %10)
%12 = load i8*, i8** %5
%13 = load i8*, i8** %6
%14 = call i32 @LateByDays(i8* %12, i8* %13)
store i32 %14, i32* %8
%15 = load i32, i32* %8
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = load i32, i32* %8
%18 = icmp slt i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %3
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%21 = call i32 @exit(i32 0)
unreachable
22: ; preds = %3
%23 = load i32, i32* %8
%24 = icmp sle i32 %23, 5
br i1 %24, label %25, label %30
25: ; preds = %22
%26 = load double, double* %7
%27 = load i32, i32* %8
%28 = sitofp i32 %27 to double
%29 = call double @llvm.fmuladd.f64(double -1.000000e+01, double %28, double %26)
store double %29, double* %4
br label %31
30: ; preds = %22
store double 0.000000e+00, double* %4
br label %31
31: ; preds = %30, %25
%32 = load double, double* %4
ret double %32
}

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