#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*/ do_next_op(char, double, double *, double *);
int /*<<< orphan*/ print_result(char, double, double, double);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scan_data(char *, double *);
int main(void) {
  double operand, akkumulator = 0.0, q = 1;
  char operator;
  printf("\nStart value is 0.0\n");
  printf("Enter operation and a value:\n");
  while (q > 0) {
    scan_data(&operator, & operand);
    do_next_op(operator, operand, &akkumulator, &q);
    print_result(operator, operand, akkumulator, q);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xea1(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11d2 <main+0x92>
lea    -0x21(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <scan_data@plt>
mov    -0x21(%rbp),%al
movsd  -0x10(%rbp),%xmm0
lea    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
movsbl %al,%edi
call   1050 <do_next_op@plt>
mov    -0x21(%rbp),%al
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsbl %al,%edi
call   1040 <print_result@plt>
jmp    117c <main+0x3c>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
movq   $0x0,0x18(%rsp)
movabs $0x3ff0000000000000,%rax
mov    %rax,0x10(%rsp)
lea    0xe9e(%rip),%rdi
call   1030 <puts@plt>
lea    0xea6(%rip),%rdi
call   1030 <puts@plt>
lea    0xf(%rsp),%r14
lea    0x20(%rsp),%r15
lea    0x18(%rsp),%r12
lea    0x10(%rsp),%rbx
nop
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <scan_data@plt>
movsbl 0xf(%rsp),%edi
movsd  0x20(%rsp),%xmm0
mov    %r12,%rsi
mov    %rbx,%rdx
call   1050 <do_next_op@plt>
movsbl 0xf(%rsp),%edi
movsd  0x20(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
call   1040 <print_result@plt>
movsd  0x10(%rsp),%xmm0
ucomisd 0xe25(%rip),%xmm0
ja     1190 <main+0x50>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [21 x i8] c"\0AStart value is 0.0\0A\00"
@.str.1 = [30 x i8] c"Enter operation and a value:\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca i8
store i32 0, i32* %1
store double 0.000000e+00, double* %3
store double 1.000000e+00, double* %4
%6 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %11, %0
%9 = load double, double* %4
%10 = fcmp ogt double %9, 0.000000e+00
br i1 %10, label %11, label %21
11: ; preds = %8
%12 = call i32 @scan_data(i8* %5, double* %2)
%13 = load i8, i8* %5
%14 = load double, double* %2
%15 = call i32 @do_next_op(i8 signext %13, double %14, double* %3, double* %4)
%16 = load i8, i8* %5
%17 = load double, double* %2
%18 = load double, double* %3
%19 = load double, double* %4
%20 = call i32 @print_result(i8 signext %16, double %17, double %18, double %19)
br label %8
21: ; preds = %8
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
@str = [20 x i8] c"\0AStart value is 0.0\00"
@str.2 = [29 x i8] c"Enter operation and a value:\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca i8
%5 = bitcast double* %1 to i8*
%6 = bitcast double* %2 to i8*
store double 0.000000e+00, double* %2
%7 = bitcast double* %3 to i8*
store double 1.000000e+00, double* %3
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.2, i64 0, i64 0))
br label %10
10: ; preds = %0, %10
%11 = call i32 @scan_data(i8* %4, double* %1)
%12 = load i8, i8* %4
%13 = load double, double* %1
%14 = call i32 @do_next_op(i8 signext %12, double %13, double* %2, double* %3)
%15 = load i8, i8* %4
%16 = load double, double* %1
%17 = load double, double* %2
%18 = load double, double* %3
%19 = call i32 @print_result(i8 signext %15, double %16, double %17, double %18)
%20 = load double, double* %3
%21 = fcmp ogt double %20, 0.000000e+00
br i1 %21, label %10, label %22
22: ; preds = %10
ret i32 0
}