#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 */
scalar_t__ getchar();
int /*<<< orphan*/ putchar(unsigned char);
int main() {
  double i1 = 0, i2, q1 = 0, q2, s;
  for (;;) {
    i2 = ((unsigned char)getchar() - 127);
    q2 = ((unsigned char)getchar() - 127);
    s = 70 * ((i2 * (q2 - q1)) - (q2 * (i2 - i1))) / (i2 * i2 + q2 * q2);
    putchar((unsigned char)(s + 127));
    i1 = i2;
    q1 = q2;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
xor    %eax,%eax
mov    %al,-0x51(%rbp)
call   1040 <getchar@plt>
mov    %rax,%rcx
mov    -0x51(%rbp),%al
movzbl %cl,%ecx
add    $0xffffff81,%ecx
cvtsi2sd %ecx,%xmm0
movsd  %xmm0,-0x18(%rbp)
call   1040 <getchar@plt>
movzbl %al,%eax
add    $0xffffff81,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm0
movaps %xmm2,%xmm4
subsd  %xmm0,%xmm4
movsd  -0x10(%rbp),%xmm3
movaps %xmm1,%xmm0
subsd  %xmm3,%xmm0
movaps %xmm2,%xmm3
mulsd  %xmm0,%xmm3
movaps %xmm1,%xmm0
mulsd  %xmm4,%xmm0
movsd  %xmm0,-0x50(%rbp)
subsd  %xmm3,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe48(%rip),%xmm3
mulsd  %xmm3,%xmm0
movsd  %xmm0,-0x40(%rbp)
mulsd  %xmm2,%xmm2
mulsd  %xmm1,%xmm1
movsd  %xmm1,-0x38(%rbp)
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  0xe20(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
movzbl %al,%edi
call   1030 <putchar@plt>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    113f <main+0x1f>

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
nopw   0x0(%rax,%rax,1)
movsd  %xmm0,0x18(%rsp)
movsd  %xmm1,0x20(%rsp)
xor    %eax,%eax
call   1040 <getchar@plt>
movzbl %al,%eax
add    $0xffffff81,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1040 <getchar@plt>
movzbl %al,%eax
add    $0xffffff81,%eax
xorps  %xmm2,%xmm2
cvtsi2sd %eax,%xmm2
movsd  %xmm2,0x10(%rsp)
movapd %xmm2,%xmm0
subsd  0x18(%rsp),%xmm0
movsd  0x8(%rsp),%xmm3
movapd %xmm3,%xmm1
subsd  0x20(%rsp),%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm3,%xmm0
subsd  %xmm1,%xmm0
mulsd  0xe62(%rip),%xmm0
movapd %xmm2,%xmm1
mulsd  %xmm2,%xmm1
movapd %xmm3,%xmm2
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
addsd  0xe4a(%rip),%xmm0
cvttsd2si %xmm0,%eax
movzbl %al,%edi
call   1030 <putchar@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
jmp    1130 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store i32 0, i32* %1
store double 0.000000e+00, double* %2
store double 0.000000e+00, double* %4
br label %7
7: ; preds = %7, %0
%8 = call i64 (...) @getchar()
%9 = trunc i64 %8 to i8
%10 = zext i8 %9 to i32
%11 = sub nsw i32 %10, 127
%12 = sitofp i32 %11 to double
store double %12, double* %3
%13 = call i64 (...) @getchar()
%14 = trunc i64 %13 to i8
%15 = zext i8 %14 to i32
%16 = sub nsw i32 %15, 127
%17 = sitofp i32 %16 to double
store double %17, double* %5
%18 = load double, double* %3
%19 = load double, double* %5
%20 = load double, double* %4
%21 = fsub double %19, %20
%22 = load double, double* %5
%23 = load double, double* %3
%24 = load double, double* %2
%25 = fsub double %23, %24
%26 = fmul double %22, %25
%27 = fneg double %26
%28 = call double @llvm.fmuladd.f64(double %18, double %21, double %27)
%29 = fmul double 7.000000e+01, %28
%30 = load double, double* %3
%31 = load double, double* %3
%32 = load double, double* %5
%33 = load double, double* %5
%34 = fmul double %32, %33
%35 = call double @llvm.fmuladd.f64(double %30, double %31, double %34)
%36 = fdiv double %29, %35
store double %36, double* %6
%37 = load double, double* %6
%38 = fadd double %37, 1.270000e+02
%39 = fptoui double %38 to i8
%40 = call i32 @putchar(i8 zeroext %39)
%41 = load double, double* %3
store double %41, double* %2
%42 = load double, double* %5
store double %42, double* %4
br label %7
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi double [ 0.000000e+00, %0 ], [ %13, %1 ]
%3 = phi double [ 0.000000e+00, %0 ], [ %8, %1 ]
%4 = tail call i64 (...) @getchar()
%5 = trunc i64 %4 to i32
%6 = and i32 %5, 255
%7 = add nsw i32 %6, -127
%8 = sitofp i32 %7 to double
%9 = tail call i64 (...) @getchar()
%10 = trunc i64 %9 to i32
%11 = and i32 %10, 255
%12 = add nsw i32 %11, -127
%13 = sitofp i32 %12 to double
%14 = fsub double %13, %2
%15 = fsub double %8, %3
%16 = fneg double %15
%17 = fmul double %16, %13
%18 = tail call double @llvm.fmuladd.f64(double %8, double %14, double %17)
%19 = fmul double %18, 7.000000e+01
%20 = fmul double %13, %13
%21 = tail call double @llvm.fmuladd.f64(double %8, double %8, double %20)
%22 = fdiv double %19, %21
%23 = fadd double %22, 1.270000e+02
%24 = fptoui double %23 to i8
%25 = tail call i32 @putchar(i8 zeroext %24)
br label %1
}