#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 *, double);
int strtod(char *, int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  if (argc < 4) {
    return 1;
  }
  double res = strtod(argv[1], NULL);
  double dep = 1 + strtod(argv[2], NULL) / 100;
  double cred = 1 + strtod(argv[3], NULL) / 100;
  for (int i = 4; i < argc; i++) {
    double oper = strtod(argv[i], NULL);
    res += oper;
    if (res < 0) {
      res *= cred;
    } else {
      res *= dep;
    }
  }
  printf("%.10g\n", res);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    114c <main+0x2c>
movl   $0x1,-0x4(%rbp)
jmp    124c <main+0x12c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <strtod@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <strtod@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
add    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <strtod@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
add    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x4,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1234 <main+0x114>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <strtod@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1212 <main+0xf2>
movsd  -0x28(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1221 <main+0x101>
movsd  -0x20(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1226 <main+0x106>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11b7 <main+0x97>
movsd  -0x18(%rbp),%xmm0
lea    0xdc0(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x1,%eax
cmp    $0x4,%edi
jl     118f <main+0x6f>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r13
mov    %edi,%r12d
mov    0x8(%rsi),%rdi
xor    %esi,%esi
call   1030 <strtod@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,(%rsp)
mov    0x10(%r13),%rdi
xor    %esi,%esi
call   1030 <strtod@plt>
mov    %eax,%r15d
mov    0x18(%r13),%rdi
xor    %esi,%esi
call   1030 <strtod@plt>
cmp    $0x4,%r12d
jne    1190 <main+0x70>
movsd  (%rsp),%xmm0
lea    0xe8e(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%r14d
mov    %r12d,%ebx
mov    $0x4,%ebp
jmp    11d2 <main+0xb2>
nopl   (%rax)
cltq
imul   $0x51eb851f,%rax,%rax
mov    %rax,%rcx
sar    $0x25,%rcx
shr    $0x3f,%rax
add    %ecx,%eax
add    $0x1,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
add    $0x1,%rbp
movsd  %xmm0,(%rsp)
cmp    %rbp,%rbx
je     1173 <main+0x53>
mov    0x0(%r13,%rbp,8),%rdi
xor    %esi,%esi
call   1030 <strtod@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  (%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
mov    %r14d,%eax
ja     11a0 <main+0x80>
mov    %r15d,%eax
jmp    11a0 <main+0x80>

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

LLVM IR (-O2):
@.str = [7 x i8] c"%.10g\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 4
br i1 %3, label %37, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @strtod(i8* nocapture %6, i32* null)
%8 = sitofp i32 %7 to double
%9 = getelementptr inbounds i8*, i8** %1, i64 2
%10 = load i8*, i8** %9
%11 = tail call i32 @strtod(i8* nocapture %10, i32* null)
%12 = getelementptr inbounds i8*, i8** %1, i64 3
%13 = load i8*, i8** %12
%14 = tail call i32 @strtod(i8* nocapture %13, i32* null)
%15 = icmp eq i32 %0, 4
br i1 %15, label %18, label %16
16: ; preds = %4
%17 = zext i32 %0 to i64
br label %21
18: ; preds = %21, %4
%19 = phi double [ %8, %4 ], [ %34, %21 ]
%20 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %19)
br label %37
21: ; preds = %16, %21
%22 = phi i64 [ 4, %16 ], [ %35, %21 ]
%23 = phi double [ %8, %16 ], [ %34, %21 ]
%24 = getelementptr inbounds i8*, i8** %1, i64 %22
%25 = load i8*, i8** %24
%26 = tail call i32 @strtod(i8* nocapture %25, i32* null)
%27 = sitofp i32 %26 to double
%28 = fadd double %23, %27
%29 = fcmp olt double %28, 0.000000e+00
%30 = select i1 %29, i32 %14, i32 %11
%31 = sdiv i32 %30, 100
%32 = add nsw i32 %31, 1
%33 = sitofp i32 %32 to double
%34 = fmul double %28, %33
%35 = add nuw nsw i64 %22, 1
%36 = icmp eq i64 %35, %17
br i1 %36, label %18, label %21
37: ; preds = %2, %18
%38 = phi i32 [ 0, %18 ], [ 1, %2 ]
ret i32 %38
}