#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 *, ...);
void main() {
  char unidade;
  float temp;
  printf("Informe a unidade da temperatura('F' ou 'C'): ");
  scanf("%c", &unidade);
  if (unidade == 'F') {
    printf("Informe a temperatura em F: ");
    scanf("%f", &temp);
    temp = ((temp - 32) * ((float)5 / 9));
    printf("Celcius: %.2f\n", temp);
  } else if (unidade == 'C') {
    printf("Informe a temperatura em C: ");
    scanf("%f", &temp);
    temp = (((float)9 / 5) * temp) + 32;
    printf("Fahrenheit: %.2f\n", temp);
  } else {
    printf("Valor informado nao corresponde!\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xefe(%rip),%rdi
lea    -0x1(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0x1(%rbp),%eax
cmp    $0x46,%eax
jne    11b3 <main+0x93>
lea    0xee2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef1(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
movss  0xe82(%rip),%xmm1
subss  %xmm1,%xmm0
movss  0xe7a(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeb7(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1231 <main+0x111>
movsbl -0x1(%rbp),%eax
cmp    $0x43,%eax
jne    121e <main+0xfe>
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe86(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
movss  0xe13(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe0b(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe78(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    122c <main+0x10c>
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1231 <main+0x111>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xef9(%rip),%rdi
lea    0x3(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x3(%rsp),%al
cmp    $0x43,%al
je     11ac <main+0x7c>
cmp    $0x46,%al
jne    11fd <main+0xcd>
lea    0xed9(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee8(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movss  0x4(%rsp),%xmm0
addss  0xe77(%rip),%xmm0
mulss  0xe73(%rip),%xmm0
movss  %xmm0,0x4(%rsp)
cvtss2sd %xmm0,%xmm0
lea    0xeb8(%rip),%rdi
jmp    11f4 <main+0xc4>
lea    0xebe(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe9e(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movss  0x4(%rsp),%xmm0
mulss  0xe25(%rip),%xmm0
addss  0xe21(%rip),%xmm0
movss  %xmm0,0x4(%rsp)
cvtss2sd %xmm0,%xmm0
lea    0xe9a(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
pop    %rax
ret
lea    0xe9c(%rip),%rdi
call   1030 <puts@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [47 x i8] c"Informe a unidade da temperatura('F' ou 'C'): \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [29 x i8] c"Informe a temperatura em F: \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [15 x i8] c"Celcius: %.2f\0A\00"
@.str.5 = [29 x i8] c"Informe a temperatura em C: \00"
@.str.6 = [18 x i8] c"Fahrenheit: %.2f\0A\00"
@.str.7 = [34 x i8] c"Valor informado nao corresponde!\0A\00"
define void @main() {
%1 = alloca i8
%2 = alloca float
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%5 = load i8, i8* %1
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 70
br i1 %7, label %8, label %17
8: ; preds = %0
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %2)
%11 = load float, float* %2
%12 = fsub float %11, 3.200000e+01
%13 = fmul float %12, 0x3FE1C71C80000000
store float %13, float* %2
%14 = load float, float* %2
%15 = fpext float %14 to double
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), double %15)
br label %32
17: ; preds = %0
%18 = load i8, i8* %1
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 67
br i1 %20, label %21, label %29
21: ; preds = %17
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %2)
%24 = load float, float* %2
%25 = call float @llvm.fmuladd.f32(float 0x3FFCCCCCC0000000, float %24, float 3.200000e+01)
store float %25, float* %2
%26 = load float, float* %2
%27 = fpext float %26 to double
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), double %27)
br label %31
29: ; preds = %17
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0))
br label %31
31: ; preds = %29, %21
br label %32
32: ; preds = %31, %8
ret void
}

LLVM IR (-O2):
@.str = [47 x i8] c"Informe a unidade da temperatura('F' ou 'C'): \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [29 x i8] c"Informe a temperatura em F: \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [15 x i8] c"Celcius: %.2f\0A\00"
@.str.5 = [29 x i8] c"Informe a temperatura em C: \00"
@.str.6 = [18 x i8] c"Fahrenheit: %.2f\0A\00"
@str = [33 x i8] c"Valor informado nao corresponde!\00"
define void @main() {
%1 = alloca i8
%2 = alloca float
%3 = bitcast float* %2 to i8*
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%6 = load i8, i8* %1
switch i8 %6, label %22 [
i8 70, label %7
i8 67, label %15
]
7: ; preds = %0
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %2)
%10 = load float, float* %2
%11 = fadd float %10, -3.200000e+01
%12 = fmul float %11, 0x3FE1C71C80000000
store float %12, float* %2
%13 = fpext float %12 to double
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), double %13)
br label %24
15: ; preds = %0
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %2)
%18 = load float, float* %2
%19 = call float @llvm.fmuladd.f32(float %18, float 0x3FFCCCCCC0000000, float 3.200000e+01)
store float %19, float* %2
%20 = fpext float %19 to double
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), double %20)
br label %24
22: ; preds = %0
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
br label %24
24: ; preds = %15, %22, %7
ret void
}