#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 *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  char x, aux;
  int y = -1, divisor = 0, dividendo = 0;
  double resultado;
  while (x != '*') {
    scanf("%c", &x);
    if (x != '*') {
      scanf(" %d", &y);
      scanf("%c", &aux);
      dividendo += (69 - x) * y;
      divisor += y;
    }
  }
  resultado = (double)dividendo / divisor;
  if (y >= 0) {
    if (y == 0) {
      resultado = 0;
    }
    printf("CR = %.4f\n", resultado);
  } else
    printf("CR = Indefinido\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x2a,%eax
je     11b7 <main+0x97>
lea    0xea8(%rip),%rdi
lea    -0x5(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x2a,%eax
je     11b2 <main+0x92>
lea    0xe8c(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xe77(%rip),%rdi
lea    -0x6(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%ecx
mov    $0x45,%eax
sub    %ecx,%eax
imul   -0xc(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1144 <main+0x24>
cvtsi2sdl -0x14(%rbp),%xmm0
cvtsi2sdl -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     11fe <main+0xde>
cmpl   $0x0,-0xc(%rbp)
jne    11e6 <main+0xc6>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
lea    0xe15(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    120c <main+0xec>
lea    0xe0d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movl   $0xffffffff,0x10(%rsp)
ff
lea    0xeb3(%rip),%rbx
lea    0xf(%rsp),%r14
lea    0x10(%rsp),%r12
lea    0x17(%rsp),%r13
xor    %ebp,%ebp
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpb   $0x2a,0xf(%rsp)
je     11d4 <main+0xa4>
lea    0xe78(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movsbl 0xf(%rsp),%ecx
mov    $0x45,%edx
sub    %ecx,%edx
mov    0x10(%rsp),%eax
imul   %eax,%edx
add    %edx,%ebp
add    %eax,%r15d
cmp    $0x2a,%ecx
jne    1170 <main+0x40>
test   %eax,%eax
js     11dc <main+0xac>
je     11ea <main+0xba>
cvtsi2sd %ebp,%xmm0
cvtsi2sd %r15d,%xmm1
divsd  %xmm1,%xmm0
jmp    11ee <main+0xbe>
mov    0x10(%rsp),%eax
test   %eax,%eax
jns    11c3 <main+0x93>
lea    0xe2f(%rip),%rdi
call   1030 <puts@plt>
jmp    11fc <main+0xcc>
xorpd  %xmm0,%xmm0
lea    0xe12(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [4 x i8] c" %d\00"
@.str.2 = [11 x i8] c"CR = %.4f\0A\00"
@.str.3 = [17 x i8] c"CR = Indefinido\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
store i32 0, i32* %1
store i32 -1, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
br label %8
8: ; preds = %30, %0
%9 = load i8, i8* %2
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 42
br i1 %11, label %12, label %31
12: ; preds = %8
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%14 = load i8, i8* %2
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 42
br i1 %16, label %17, label %30
17: ; preds = %12
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%20 = load i8, i8* %2
%21 = sext i8 %20 to i32
%22 = sub nsw i32 69, %21
%23 = load i32, i32* %4
%24 = mul nsw i32 %22, %23
%25 = load i32, i32* %6
%26 = add nsw i32 %25, %24
store i32 %26, i32* %6
%27 = load i32, i32* %4
%28 = load i32, i32* %5
%29 = add nsw i32 %28, %27
store i32 %29, i32* %5
br label %30
30: ; preds = %17, %12
br label %8
31: ; preds = %8
%32 = load i32, i32* %6
%33 = sitofp i32 %32 to double
%34 = load i32, i32* %5
%35 = sitofp i32 %34 to double
%36 = fdiv double %33, %35
store double %36, double* %7
%37 = load i32, i32* %4
%38 = icmp sge i32 %37, 0
br i1 %38, label %39, label %46
39: ; preds = %31
%40 = load i32, i32* %4
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %43
42: ; preds = %39
store double 0.000000e+00, double* %7
br label %43
43: ; preds = %42, %39
%44 = load double, double* %7
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), double %44)
br label %48
46: ; preds = %31
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %48
48: ; preds = %46, %43
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
@.str.1 = [4 x i8] c" %d\00"
@.str.2 = [11 x i8] c"CR = %.4f\0A\00"
@str = [16 x i8] c"CR = Indefinido\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca i8
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 -1, i32* %3
br label %5
5: ; preds = %0, %13
%6 = phi i32 [ %21, %13 ], [ 0, %0 ]
%7 = phi i32 [ %22, %13 ], [ 0, %0 ]
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%9 = load i8, i8* %1
%10 = icmp eq i8 %9, 42
br i1 %10, label %11, label %13
11: ; preds = %5
%12 = load i32, i32* %3
br label %24
13: ; preds = %5
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%16 = load i8, i8* %1
%17 = sext i8 %16 to i32
%18 = sub nsw i32 69, %17
%19 = load i32, i32* %3
%20 = mul nsw i32 %18, %19
%21 = add nsw i32 %20, %6
%22 = add nsw i32 %19, %7
%23 = icmp eq i8 %16, 42
br i1 %23, label %24, label %5
24: ; preds = %13, %11
%25 = phi i32 [ %12, %11 ], [ %19, %13 ]
%26 = phi i32 [ %6, %11 ], [ %21, %13 ]
%27 = phi i32 [ %7, %11 ], [ %22, %13 ]
%28 = icmp sgt i32 %25, -1
br i1 %28, label %29, label %36
29: ; preds = %24
%30 = sitofp i32 %26 to double
%31 = sitofp i32 %27 to double
%32 = fdiv double %30, %31
%33 = icmp eq i32 %25, 0
%34 = select i1 %33, double 0.000000e+00, double %32
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), double %34)
br label %38
36: ; preds = %24
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
br label %38
38: ; preds = %36, %29
ret i32 0
}