#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 EOF;
int /*<<< orphan*/ calculate(double, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int /*<<< orphan*/);
int fscanf(int /*<<< orphan*/, char *, double *);
int /*<<< orphan*/ skipWord(int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int stdinprocess(char *expression) {
  double res;
  int test;
  while ((test = fscanf(stdin, "%lf", &res)) != EOF) {
    if (test == 0)
      skipWord(stdin);
    else {
      fprintf(stdout, "%lf\n", calculate(res, expression));
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<stdinprocess>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
lea    0xea4(%rip),%rsi
lea    -0x10(%rbp),%rdx
call   1040 <fscanf@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e71(%rip),%rcx
cmp    (%rcx),%eax
je     11c4 <stdinprocess+0x84>
cmpl   $0x0,-0x14(%rbp)
jne    1194 <stdinprocess+0x54>
mov    0x2e60(%rip),%rax
mov    (%rax),%edi
call   1060 <skipWord@plt>
jmp    11bf <stdinprocess+0x7f>
mov    0x2e35(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%rdi
call   1030 <calculate@plt>
mov    -0x18(%rbp),%edi
mov    %eax,%edx
lea    0xe4a(%rip),%rsi
call   1050 <fprintf@plt>
jmp    114c <stdinprocess+0xc>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stdinprocess>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r13
mov    0x2e93(%rip),%rbx
mov    (%rbx),%edi
lea    0xea2(%rip),%rsi
mov    %rsp,%rdx
call   1040 <fscanf@plt>
mov    0x2e73(%rip),%r12
cmp    (%r12),%eax
jne    1187 <stdinprocess+0x47>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe72(%rip),%r14
mov    %rsp,%r15
jmp    11d9 <stdinprocess+0x99>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x2e29(%rip),%rax
mov    (%rax),%ebp
movsd  (%rsp),%xmm0
mov    %r13,%rdi
call   1030 <calculate@plt>
mov    %ebp,%edi
lea    0xe45(%rip),%rsi
mov    %eax,%edx
call   1050 <fprintf@plt>
mov    (%rbx),%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <fscanf@plt>
cmp    (%r12),%eax
je     1173 <stdinprocess+0x33>
test   %eax,%eax
jne    11a0 <stdinprocess+0x60>
mov    (%rbx),%edi
call   1060 <skipWord@plt>
jmp    11c6 <stdinprocess+0x86>

LLVM IR (-O0):
@stdin = global i32 0
@.str = [4 x i8] c"%lf\00"
@EOF = global i32 0
@stdout = global i32 0
@.str.1 = [5 x i8] c"%lf\0A\00"
define i32 @stdinprocess(i8* %0) {
%2 = alloca i8*
%3 = alloca double
%4 = alloca i32
store i8* %0, i8** %2
br label %5
5: ; preds = %22, %1
%6 = load i32, i32* @stdin
%7 = call i32 @fscanf(i32 %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %3)
store i32 %7, i32* %4
%8 = load i32, i32* @EOF
%9 = icmp ne i32 %7, %8
br i1 %9, label %10, label %23
10: ; preds = %5
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i32, i32* @stdin
%15 = call i32 @skipWord(i32 %14)
br label %22
16: ; preds = %10
%17 = load i32, i32* @stdout
%18 = load double, double* %3
%19 = load i8*, i8** %2
%20 = call i32 @calculate(double %18, i8* %19)
%21 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %20)
br label %22
22: ; preds = %16, %13
br label %5
23: ; preds = %5
ret i32 1
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [4 x i8] c"%lf\00"
@EOF = global i32 0
@stdout = global i32 0
@.str.1 = [5 x i8] c"%lf\0A\00"
define i32 @stdinprocess(i8* %0) {
%2 = alloca double
%3 = bitcast double* %2 to i8*
%4 = load i32, i32* @stdin
%5 = call i32 @fscanf(i32 %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %2)
%6 = load i32, i32* @EOF
%7 = icmp eq i32 %5, %6
br i1 %7, label %24, label %8
8: ; preds = %1, %19
%9 = phi i32 [ %21, %19 ], [ %5, %1 ]
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i32, i32* @stdin
%13 = call i32 @skipWord(i32 %12)
br label %19
14: ; preds = %8
%15 = load i32, i32* @stdout
%16 = load double, double* %2
%17 = call i32 @calculate(double %16, i8* %0)
%18 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %14, %11
%20 = load i32, i32* @stdin
%21 = call i32 @fscanf(i32 %20, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %2)
%22 = load i32, i32* @EOF
%23 = icmp eq i32 %21, %22
br i1 %23, label %24, label %8
24: ; preds = %19, %1
ret i32 1
}