#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 */
double evaluate(char *, double *, double *, int *, double);
scalar_t__ getln(char *);
int /*<<< orphan*/ printf(char *, double);
int main(void) {
  char str_buf[100];
  double num_buf[100 - 1];
  double var_buf[26] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                        0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                        0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
  int index[3] = {0, 0, 0};
  double last = 0.0;
  while (getln(str_buf))
    printf("%f\n", last = evaluate(str_buf, num_buf, var_buf, index, last));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x480,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x460(%rbp),%rdi
xor    %esi,%esi
mov    $0xd0,%edx
call   1050 <memset@plt>
lea    -0x46c(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1050 <memset@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x478(%rbp)
ff
lea    -0x70(%rbp),%rdi
call   1030 <getln@plt>
cmp    $0x0,%rax
je     11d5 <main+0x95>
lea    -0x70(%rbp),%rdi
lea    -0x390(%rbp),%rsi
lea    -0x460(%rbp),%rdx
lea    -0x46c(%rbp),%rcx
movsd  -0x478(%rbp),%xmm0
ff
call   1060 <evaluate@plt>
movsd  %xmm0,-0x478(%rbp)
ff
lea    0xe35(%rip),%rdi
call   1040 <printf@plt>
jmp    1183 <main+0x43>
xor    %eax,%eax
add    $0x480,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x480,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movl   $0x0,0x18(%rsp)
movq   $0x0,0x10(%rsp)
lea    0xf0(%rsp),%rdi
call   1030 <getln@plt>
test   %rax,%rax
je     1212 <main+0xe2>
xorps  %xmm0,%xmm0
lea    0xf0(%rsp),%rbx
lea    0x160(%rsp),%r14
lea    0x20(%rsp),%r15
lea    0x10(%rsp),%r12
lea    0xe20(%rip),%r13
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
call   1050 <evaluate@plt>
movsd  %xmm0,0x8(%rsp)
mov    %r13,%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <getln@plt>
movsd  0x8(%rsp),%xmm0
test   %rax,%rax
jne    11e0 <main+0xb0>
xor    %eax,%eax
add    $0x480,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca [99 x double]
%4 = alloca [26 x double]
%5 = alloca [3 x i32]
%6 = alloca double
store i32 0, i32* %1
%7 = bitcast [26 x double]* %4 to i8*
%8 = bitcast [3 x i32]* %5 to i8*
store double 0.000000e+00, double* %6
br label %9
9: ; preds = %13, %0
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%11 = call i64 @getln(i8* %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %21
13: ; preds = %9
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%15 = getelementptr inbounds [99 x double], [99 x double]* %3, i64 0, i64 0
%16 = getelementptr inbounds [26 x double], [26 x double]* %4, i64 0, i64 0
%17 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 0
%18 = load double, double* %6
%19 = call double @evaluate(i8* %14, double* %15, double* %16, i32* %17, double %18)
store double %19, double* %6
%20 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %19)
br label %9
21: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [99 x double]
%3 = alloca [26 x double]
%4 = alloca [3 x i32]
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%6 = bitcast [99 x double]* %2 to i8*
%7 = bitcast [26 x double]* %3 to i8*
%8 = bitcast [3 x i32]* %4 to i8*
%9 = call i64 @getln(i8* %5)
%10 = icmp eq i64 %9, 0
br i1 %10, label %21, label %11
11: ; preds = %0
%12 = getelementptr inbounds [99 x double], [99 x double]* %2, i64 0, i64 0
%13 = getelementptr inbounds [26 x double], [26 x double]* %3, i64 0, i64 0
%14 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 0
br label %15
15: ; preds = %11, %15
%16 = phi double [ 0.000000e+00, %11 ], [ %17, %15 ]
%17 = call double @evaluate(i8* %5, double* %12, double* %13, i32* %14, double %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %17)
%19 = call i64 @getln(i8* %5)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %15
21: ; preds = %15, %0
ret i32 0
}