#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *, char *);
float read_number(char *);
int /*<<< orphan*/ sprintf(char *, char *, float);
int /*<<< orphan*/ stderr;
int strlen(char *);
int main(int argc, char **argv) {
  float dd, dh, dr, hh, hr;
  char buf[64];
  size_t len;
  if (argc < 7) {
    fprintf(stderr, "usage: %s DD DH DR HH HR RR\n", argv[0]);
    exit(1);
  }
  dd = read_number(argv[1]);
  dh = read_number(argv[2]);
  dr = read_number(argv[3]);
  hh = read_number(argv[4]);
  hr = read_number(argv[5]);
  read_number(argv[6]);
  sprintf(buf, "%f", (dd + dh + dr + (hh * 0.75) + (hr * 0.5)) * 2);
  for (len = strlen(buf) - 1; buf[len] == '0' || buf[len] == '.'; len--)
    ;
  buf[len + 1] = '\0';
  printf("%s\n", buf);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x7,-0x8(%rbp)
jge    11a9 <main+0x49>
mov    0x2e56(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe7e(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <read_number@plt>
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <read_number@plt>
movss  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1060 <read_number@plt>
movss  %xmm0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1060 <read_number@plt>
movss  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
call   1060 <read_number@plt>
movss  %xmm0,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    0x30(%rax),%rdi
call   1060 <read_number@plt>
lea    -0x70(%rbp),%rdi
movss  -0x14(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
addss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x20(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xdd8(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdb7(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xd9f(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xdc5(%rip),%rsi
call   1070 <sprintf@plt>
lea    -0x70(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
cltq
mov    %rax,-0x78(%rbp)
mov    -0x78(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%ecx
mov    $0x1,%al
cmp    $0x30,%ecx
mov    %al,-0x79(%rbp)
je     12b0 <main+0x150>
mov    -0x78(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x2e,%eax
sete   %al
mov    %al,-0x79(%rbp)
mov    -0x79(%rbp),%al
test   $0x1,%al
jne    12c0 <main+0x160>
jmp    12d6 <main+0x176>
jmp    12c5 <main+0x165>
mov    -0x78(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x78(%rbp)
jmp    1287 <main+0x127>
mov    -0x78(%rbp),%rax
movb   $0x0,-0x6f(%rbp,%rax,1)
lea    -0x70(%rbp),%rsi
lea    0xd4e(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x60,%rsp
mov    %rsi,%rbx
cmp    $0x6,%edi
jle    126e <main+0x10e>
mov    0x8(%rbx),%rdi
call   1060 <read_number@plt>
movss  %xmm0,0x1c(%rsp)
mov    0x10(%rbx),%rdi
call   1060 <read_number@plt>
movss  %xmm0,0x18(%rsp)
mov    0x18(%rbx),%rdi
call   1060 <read_number@plt>
movss  %xmm0,0x14(%rsp)
mov    0x20(%rbx),%rdi
call   1060 <read_number@plt>
movss  %xmm0,0x10(%rsp)
mov    0x28(%rbx),%rdi
call   1060 <read_number@plt>
movss  %xmm0,0xc(%rsp)
mov    0x30(%rbx),%rdi
call   1060 <read_number@plt>
movss  0x18(%rsp),%xmm0
addss  0x1c(%rsp),%xmm0
addss  0x14(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x10(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  0xe13(%rip),%xmm1
addsd  %xmm0,%xmm1
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe05(%rip),%xmm0
addsd  %xmm1,%xmm0
addsd  %xmm0,%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xe17(%rip),%rsi
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   1070 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
add    %rbx,%rax
jmp    1244 <main+0xe4>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0xffffffffffffffff,%rax
movzbl -0x1(%rax),%ecx
cmp    $0x30,%cl
je     1240 <main+0xe0>
cmp    $0x2e,%cl
je     1240 <main+0xe0>
movb   $0x0,(%rax)
lea    0xdd4(%rip),%rdi
lea    0x20(%rsp),%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
ret
mov    0x2d6b(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xd8f(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [29 x i8] c"usage: %s DD DH DR HH HR RR\0A\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca [64 x i8]
%12 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 7
br i1 %14, label %15, label %22
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call float @read_number(i8* %25)
store float %26, float* %6
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 2
%29 = load i8*, i8** %28
%30 = call float @read_number(i8* %29)
store float %30, float* %7
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 3
%33 = load i8*, i8** %32
%34 = call float @read_number(i8* %33)
store float %34, float* %8
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 4
%37 = load i8*, i8** %36
%38 = call float @read_number(i8* %37)
store float %38, float* %9
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 5
%41 = load i8*, i8** %40
%42 = call float @read_number(i8* %41)
store float %42, float* %10
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 6
%45 = load i8*, i8** %44
%46 = call float @read_number(i8* %45)
%47 = getelementptr inbounds [64 x i8], [64 x i8]* %11, i64 0, i64 0
%48 = load float, float* %6
%49 = load float, float* %7
%50 = fadd float %48, %49
%51 = load float, float* %8
%52 = fadd float %50, %51
%53 = fpext float %52 to double
%54 = load float, float* %9
%55 = fpext float %54 to double
%56 = call double @llvm.fmuladd.f64(double %55, double 7.500000e-01, double %53)
%57 = load float, float* %10
%58 = fpext float %57 to double
%59 = call double @llvm.fmuladd.f64(double %58, double 5.000000e-01, double %56)
%60 = fmul double %59, 2.000000e+00
%61 = fptrunc double %60 to float
%62 = call i32 @sprintf(i8* %47, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float %61)
%63 = getelementptr inbounds [64 x i8], [64 x i8]* %11, i64 0, i64 0
%64 = call i32 @strlen(i8* %63)
%65 = sub nsw i32 %64, 1
%66 = sext i32 %65 to i64
store i64 %66, i64* %12
br label %67
67: ; preds = %82, %22
%68 = load i64, i64* %12
%69 = getelementptr inbounds [64 x i8], [64 x i8]* %11, i64 0, i64 %68
%70 = load i8, i8* %69
%71 = sext i8 %70 to i32
%72 = icmp eq i32 %71, 48
br i1 %72, label %79, label %73
73: ; preds = %67
%74 = load i64, i64* %12
%75 = getelementptr inbounds [64 x i8], [64 x i8]* %11, i64 0, i64 %74
%76 = load i8, i8* %75
%77 = sext i8 %76 to i32
%78 = icmp eq i32 %77, 46
br label %79
79: ; preds = %73, %67
%80 = phi i1 [ true, %67 ], [ %78, %73 ]
br i1 %80, label %81, label %85
81: ; preds = %79
br label %82
82: ; preds = %81
%83 = load i64, i64* %12
%84 = add i64 %83, -1
store i64 %84, i64* %12
br label %67
85: ; preds = %79
%86 = load i64, i64* %12
%87 = add i64 %86, 1
%88 = getelementptr inbounds [64 x i8], [64 x i8]* %11, i64 0, i64 %87
store i8 0, i8* %88
%89 = getelementptr inbounds [64 x i8], [64 x i8]* %11, i64 0, i64 0
%90 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %89)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [29 x i8] c"usage: %s DD DH DR HH HR RR\0A\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [64 x i8]
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%5 = icmp slt i32 %0, 7
br i1 %5, label %6, label %11
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %1
%9 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call float @read_number(i8* %13)
%15 = getelementptr inbounds i8*, i8** %1, i64 2
%16 = load i8*, i8** %15
%17 = tail call float @read_number(i8* %16)
%18 = getelementptr inbounds i8*, i8** %1, i64 3
%19 = load i8*, i8** %18
%20 = tail call float @read_number(i8* %19)
%21 = getelementptr inbounds i8*, i8** %1, i64 4
%22 = load i8*, i8** %21
%23 = tail call float @read_number(i8* %22)
%24 = getelementptr inbounds i8*, i8** %1, i64 5
%25 = load i8*, i8** %24
%26 = tail call float @read_number(i8* %25)
%27 = getelementptr inbounds i8*, i8** %1, i64 6
%28 = load i8*, i8** %27
%29 = tail call float @read_number(i8* %28)
%30 = fadd float %14, %17
%31 = fadd float %30, %20
%32 = fpext float %31 to double
%33 = fpext float %23 to double
%34 = tail call double @llvm.fmuladd.f64(double %33, double 7.500000e-01, double %32)
%35 = fpext float %26 to double
%36 = tail call double @llvm.fmuladd.f64(double %35, double 5.000000e-01, double %34)
%37 = fmul double %36, 2.000000e+00
%38 = fptrunc double %37 to float
%39 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float %38)
%40 = call i32 @strlen(i8* %4)
%41 = add nsw i32 %40, -1
%42 = sext i32 %41 to i64
br label %43
43: ; preds = %47, %11
%44 = phi i64 [ %42, %11 ], [ %48, %47 ]
%45 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 %44
%46 = load i8, i8* %45
switch i8 %46, label %49 [
i8 48, label %47
i8 46, label %47
]
47: ; preds = %43, %43
%48 = add i64 %44, -1
br label %43
49: ; preds = %43
%50 = add i64 %44, 1
%51 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 %50
store i8 0, i8* %51
%52 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %4)
ret i32 0
}