#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*/ LC_ALL;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
int main() {
  setlocale(LC_ALL, "");
  float valorPremio = 0;
  float apostador1 = 0, apostador2 = 0, apostador3 = 0;
  float valorApostadoTotal = 0;
  float premioProporcionalApostador1 = 0;
  float premioProporcionalApostador2 = 0;
  float premioProporcionalApostador3 = 0;
  printf("Insira o valor do prêmio: ");
  scanf("%f", &valorPremio);
  printf("Insira valor do apostador 1: ");
  scanf("%f", &apostador1);
  printf("Insira valor do apostador 2: ");
  scanf("%f", &apostador2);
  printf("Insira valor do apostador 3: ");
  scanf("%f", &apostador3);
  valorApostadoTotal = apostador1 + apostador2 + apostador3;
  premioProporcionalApostador1 = (apostador1 / valorApostadoTotal) * 100;
  premioProporcionalApostador2 = (apostador2 / valorApostadoTotal) * 100;
  premioProporcionalApostador3 = (apostador3 / valorApostadoTotal) * 100;
  printf("Apostador 1 recebe: %f\n", premioProporcionalApostador1);
  printf("Apostador 2 recebe: %f\n", premioProporcionalApostador2);
  printf("Apostador 3 recebe: %f\n", premioProporcionalApostador3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
lea    0xf45(%rip),%rsi
call   1040 <setlocale@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe77(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe59(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe3b(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe1d(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
movss  -0xc(%rbp),%xmm0
addss  -0x10(%rbp),%xmm0
addss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
divss  -0x18(%rbp),%xmm0
movss  0xdce(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x10(%rbp),%xmm0
divss  -0x18(%rbp),%xmm0
movss  0xdb3(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x14(%rbp),%xmm0
divss  -0x18(%rbp),%xmm0
movss  0xd98(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdfc(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdfd(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdfe(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    0x2ea4(%rip),%rax
mov    (%rax),%edi
lea    0xf4f(%rip),%rsi
call   1040 <setlocale@plt>
movl   $0x0,0x1c(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
lea    0xe93(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xea1(%rip),%rbx
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xe90(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xe93(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xe96(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movss  0x10(%rsp),%xmm0
movss  0xc(%rsp),%xmm4
movaps %xmm0,%xmm1
addss  %xmm4,%xmm1
movss  0x8(%rsp),%xmm3
addss  %xmm3,%xmm1
divss  %xmm1,%xmm0
movss  0xdfa(%rip),%xmm2
mulss  %xmm2,%xmm0
divss  %xmm1,%xmm4
mulss  %xmm2,%xmm4
movss  %xmm4,0x14(%rsp)
divss  %xmm1,%xmm3
mulss  %xmm2,%xmm3
movss  %xmm3,0x18(%rsp)
cvtss2sd %xmm0,%xmm0
lea    0xe4c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  0x14(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe4c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  0x18(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe4c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@LC_ALL = global i32 0
@.str = [1 x i8] zeroinitializer
@.str.1 = [28 x i8] c"Insira o valor do pr\C3\AAmio: \00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [30 x i8] c"Insira valor do apostador 1: \00"
@.str.4 = [30 x i8] c"Insira valor do apostador 2: \00"
@.str.5 = [30 x i8] c"Insira valor do apostador 3: \00"
@.str.6 = [24 x i8] c"Apostador 1 recebe: %f\0A\00"
@.str.7 = [24 x i8] c"Apostador 2 recebe: %f\0A\00"
@.str.8 = [24 x i8] c"Apostador 3 recebe: %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
store i32 0, i32* %1
%10 = load i32, i32* @LC_ALL
%11 = call i32 @setlocale(i32 %10, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
store float 0.000000e+00, float* %2
store float 0.000000e+00, float* %3
store float 0.000000e+00, float* %4
store float 0.000000e+00, float* %5
store float 0.000000e+00, float* %6
store float 0.000000e+00, float* %7
store float 0.000000e+00, float* %8
store float 0.000000e+00, float* %9
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %2)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %3)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %4)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %5)
%20 = load float, float* %3
%21 = load float, float* %4
%22 = fadd float %20, %21
%23 = load float, float* %5
%24 = fadd float %22, %23
store float %24, float* %6
%25 = load float, float* %3
%26 = load float, float* %6
%27 = fdiv float %25, %26
%28 = fmul float %27, 1.000000e+02
store float %28, float* %7
%29 = load float, float* %4
%30 = load float, float* %6
%31 = fdiv float %29, %30
%32 = fmul float %31, 1.000000e+02
store float %32, float* %8
%33 = load float, float* %5
%34 = load float, float* %6
%35 = fdiv float %33, %34
%36 = fmul float %35, 1.000000e+02
store float %36, float* %9
%37 = load float, float* %7
%38 = fpext float %37 to double
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), double %38)
%40 = load float, float* %8
%41 = fpext float %40 to double
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), double %41)
%43 = load float, float* %9
%44 = fpext float %43 to double
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0), double %44)
ret i32 0
}

LLVM IR (-O2):
@LC_ALL = global i32 0
@.str = [1 x i8] zeroinitializer
@.str.1 = [28 x i8] c"Insira o valor do pr\C3\AAmio: \00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [30 x i8] c"Insira valor do apostador 1: \00"
@.str.4 = [30 x i8] c"Insira valor do apostador 2: \00"
@.str.5 = [30 x i8] c"Insira valor do apostador 3: \00"
@.str.6 = [24 x i8] c"Apostador 1 recebe: %f\0A\00"
@.str.7 = [24 x i8] c"Apostador 2 recebe: %f\0A\00"
@.str.8 = [24 x i8] c"Apostador 3 recebe: %f\0A\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = load i32, i32* @LC_ALL
%6 = tail call i32 @setlocale(i32 %5, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%7 = bitcast float* %1 to i8*
store float 0.000000e+00, float* %1
%8 = bitcast float* %2 to i8*
store float 0.000000e+00, float* %2
%9 = bitcast float* %3 to i8*
store float 0.000000e+00, float* %3
%10 = bitcast float* %4 to i8*
store float 0.000000e+00, float* %4
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %1)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %2)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %3)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %4)
%19 = load float, float* %2
%20 = load float, float* %3
%21 = fadd float %19, %20
%22 = load float, float* %4
%23 = fadd float %21, %22
%24 = fdiv float %19, %23
%25 = fmul float %24, 1.000000e+02
%26 = fdiv float %20, %23
%27 = fmul float %26, 1.000000e+02
%28 = fdiv float %22, %23
%29 = fmul float %28, 1.000000e+02
%30 = fpext float %25 to double
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), double %30)
%32 = fpext float %27 to double
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), double %32)
%34 = fpext float %29 to double
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0), double %34)
ret i32 0
}