#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 *, float *);
int main() {
  float quilos = 1.0E3;
  double gramas = 1.0e3;
  float n_toneladas;
  printf("Qual o numero de toneladas? ");
  scanf("%f", &n_toneladas);
  printf("O numero de toneladas em quilos é: %f = %e \n", n_toneladas * quilos,
         n_toneladas * quilos);
  printf("O numero de toneladas em gramas é: %f = %E \n\n",
         n_toneladas * gramas, n_toneladas * gramas);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xed1(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movsd  0xebc(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x14(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x14(%rbp),%xmm1
mulss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xea2(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  -0x10(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  -0x10(%rbp),%xmm1
lea    0xea6(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef7(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm0
mulss  0xeb2(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xed7(%rip),%rdi
movaps %xmm0,%xmm1
mov    $0x2,%al
call   1030 <printf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe93(%rip),%xmm0
lea    0xee2(%rip),%rdi
movapd %xmm0,%xmm1
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Qual o numero de toneladas? \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [46 x i8] c"O numero de toneladas em quilos \C3\A9: %f = %e \0A\00"
@.str.3 = [47 x i8] c"O numero de toneladas em gramas \C3\A9: %f = %E \0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca double
%4 = alloca float
store i32 0, i32* %1
store float 1.000000e+03, float* %2
store double 1.000000e+03, double* %3
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
%7 = load float, float* %4
%8 = load float, float* %2
%9 = fmul float %7, %8
%10 = fpext float %9 to double
%11 = load float, float* %4
%12 = load float, float* %2
%13 = fmul float %11, %12
%14 = fpext float %13 to double
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), double %10, double %14)
%16 = load float, float* %4
%17 = fpext float %16 to double
%18 = load double, double* %3
%19 = fmul double %17, %18
%20 = load float, float* %4
%21 = fpext float %20 to double
%22 = load double, double* %3
%23 = fmul double %21, %22
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0), double %19, double %23)
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"Qual o numero de toneladas? \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [46 x i8] c"O numero de toneladas em quilos \C3\A9: %f = %e \0A\00"
@.str.3 = [47 x i8] c"O numero de toneladas em gramas \C3\A9: %f = %E \0A\0A\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%5 = load float, float* %1
%6 = fmul float %5, 1.000000e+03
%7 = fpext float %6 to double
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), double %7, double %7)
%9 = load float, float* %1
%10 = fpext float %9 to double
%11 = fmul double %10, 1.000000e+03
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0), double %11, double %11)
ret i32 0
}