#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*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char *argv[]) {
  int hw[4];
  int i;
  const double hw_p[4] = {0.25, 0.15, 0.35, 0.25};
  double total = 0;
  scanf("%d", hw);
  scanf("%d", hw + 1);
  scanf("%d", hw + 2);
  scanf("%d", hw + 3);
  for (i = 0; i < 4; i++)
    total += (hw[i] * hw_p[i]);
  printf("%.2lf\n", total);
  for (i = 0; i < 4; i++)
    printf("%.2lf\n", hw[i] * hw_p[i]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xec0(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xebd(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
lea    -0x20(%rbp),%rsi
lea    0xeab(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x20(%rbp),%rsi
add    $0x4,%rsi
lea    0xe97(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x20(%rbp),%rsi
add    $0x8,%rsi
lea    0xe83(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x20(%rbp),%rsi
add    $0xc,%rsi
lea    0xe6f(%rip),%rdi
call   1040 <scanf@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x4,-0x24(%rbp)
jge    11fb <main+0xdb>
movslq -0x24(%rbp),%rax
cvtsi2sdl -0x20(%rbp,%rax,4),%xmm0
movslq -0x24(%rbp),%rax
movsd  -0x50(%rbp,%rax,8),%xmm2
movsd  -0x58(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11bd <main+0x9d>
cvttsd2si -0x58(%rbp),%esi
lea    0xe1c(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x4,-0x24(%rbp)
jge    124f <main+0x12f>
movslq -0x24(%rbp),%rax
cvtsi2sdl -0x20(%rbp,%rax,4),%xmm0
movslq -0x24(%rbp),%rax
mulsd  -0x50(%rbp,%rax,8),%xmm0
cvttsd2si %xmm0,%esi
lea    0xde7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1213 <main+0xf3>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xeec(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
cvtsi2sdl (%rsp),%xmm0
movsd  0xe95(%rip),%xmm1
mulsd  %xmm1,%xmm0
movapd %xmm1,%xmm2
xorpd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2sdl 0x4(%rsp),%xmm0
mulsd  0xe7c(%rip),%xmm0
addsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdl 0x8(%rsp),%xmm1
mulsd  0xe6f(%rip),%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2sdl 0xc(%rsp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
lea    0xe5a(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
cvtsi2sdl (%rsp),%xmm0
mulsd  0xe27(%rip),%xmm0
cvttsd2si %xmm0,%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
cvtsi2sdl 0x4(%rsp),%xmm0
mulsd  0xe12(%rip),%xmm0
cvttsd2si %xmm0,%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
cvtsi2sdl 0x8(%rsp),%xmm0
mulsd  0xdfd(%rip),%xmm0
cvttsd2si %xmm0,%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
cvtsi2sdl 0xc(%rsp),%xmm0
mulsd  0xdd0(%rip),%xmm0
cvttsd2si %xmm0,%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.hw_p = [4 x double] [double 2.500000e-01, double 1.500000e-01, double 3.500000e-01, double 2.500000e-01]
@.str = [3 x i8] c"%d\00"
@.str.1 = [7 x i8] c"%.2lf\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [4 x i32]
%7 = alloca i32
%8 = alloca [4 x double]
%9 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = bitcast [4 x double]* %8 to i8*
store double 0.000000e+00, double* %9
%11 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 0
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %11)
%13 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 0
%14 = getelementptr inbounds i32, i32* %13, i64 1
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %14)
%16 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 0
%17 = getelementptr inbounds i32, i32* %16, i64 2
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %17)
%19 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 0
%20 = getelementptr inbounds i32, i32* %19, i64 3
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %20)
store i32 0, i32* %7
br label %22
22: ; preds = %37, %2
%23 = load i32, i32* %7
%24 = icmp slt i32 %23, 4
br i1 %24, label %25, label %40
25: ; preds = %22
%26 = load i32, i32* %7
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 %27
%29 = load i32, i32* %28
%30 = sitofp i32 %29 to double
%31 = load i32, i32* %7
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [4 x double], [4 x double]* %8, i64 0, i64 %32
%34 = load double, double* %33
%35 = load double, double* %9
%36 = call double @llvm.fmuladd.f64(double %30, double %34, double %35)
store double %36, double* %9
br label %37
37: ; preds = %25
%38 = load i32, i32* %7
%39 = add nsw i32 %38, 1
store i32 %39, i32* %7
br label %22
40: ; preds = %22
%41 = load double, double* %9
%42 = fptosi double %41 to i32
%43 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %42)
store i32 0, i32* %7
br label %44
44: ; preds = %60, %40
%45 = load i32, i32* %7
%46 = icmp slt i32 %45, 4
br i1 %46, label %47, label %63
47: ; preds = %44
%48 = load i32, i32* %7
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 %49
%51 = load i32, i32* %50
%52 = sitofp i32 %51 to double
%53 = load i32, i32* %7
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [4 x double], [4 x double]* %8, i64 0, i64 %54
%56 = load double, double* %55
%57 = fmul double %52, %56
%58 = fptosi double %57 to i32
%59 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %58)
br label %60
60: ; preds = %47
%61 = load i32, i32* %7
%62 = add nsw i32 %61, 1
store i32 %62, i32* %7
br label %44
63: ; preds = %44
%64 = load i32, i32* %3
ret i32 %64
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [7 x i8] c"%.2lf\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [4 x i32]
%4 = bitcast [4 x i32]* %3 to i8*
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%7 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 1
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
%9 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 2
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %9)
%11 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 3
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %11)
%13 = load i32, i32* %5
%14 = sitofp i32 %13 to double
%15 = call double @llvm.fmuladd.f64(double %14, double 2.500000e-01, double 0.000000e+00)
%16 = load i32, i32* %7
%17 = sitofp i32 %16 to double
%18 = call double @llvm.fmuladd.f64(double %17, double 1.500000e-01, double %15)
%19 = load i32, i32* %9
%20 = sitofp i32 %19 to double
%21 = call double @llvm.fmuladd.f64(double %20, double 3.500000e-01, double %18)
%22 = load i32, i32* %11
%23 = sitofp i32 %22 to double
%24 = call double @llvm.fmuladd.f64(double %23, double 2.500000e-01, double %21)
%25 = fptosi double %24 to i32
%26 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = load i32, i32* %5
%28 = sitofp i32 %27 to double
%29 = fmul double %28, 2.500000e-01
%30 = fptosi double %29 to i32
%31 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %30)
%32 = load i32, i32* %7
%33 = sitofp i32 %32 to double
%34 = fmul double %33, 1.500000e-01
%35 = fptosi double %34 to i32
%36 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %35)
%37 = load i32, i32* %9
%38 = sitofp i32 %37 to double
%39 = fmul double %38, 3.500000e-01
%40 = fptosi double %39 to i32
%41 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %40)
%42 = load i32, i32* %11
%43 = sitofp i32 %42 to double
%44 = fmul double %43, 2.500000e-01
%45 = fptosi double %44 to i32
%46 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %45)
ret i32 0
}