#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*/ celsius(float);
int /*<<< orphan*/ farenheit(float);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
int main(int argc, const char *argv[]) {
  int temperature;
  float number;
  printf("digite 1 para converter de farenheit para celsius e 2 para converter "
         "de celsius para farenheit:\n");
  scanf("%d", &temperature);
  switch (temperature) {
  case 1:
    printf("temperatura F°:\n");
    scanf("%f", &number);
    celsius(number);
    break;
  case 2:
    printf("temperatura C°:\n");
    scanf("%f", &number);
    farenheit(number);
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
lea    0xef8(%rip),%rdi
xor    %eax,%eax
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x1,%eax
je     1199 <main+0x59>
jmp    1188 <main+0x48>
mov    -0x1c(%rbp),%eax
sub    $0x2,%eax
je     11c6 <main+0x86>
jmp    11ee <main+0xae>
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
lea    0xeca(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movss  -0x18(%rbp),%xmm0
call   1060 <celsius@plt>
jmp    11ee <main+0xae>
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
lea    0xe9d(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movss  -0x18(%rbp),%xmm0
call   1040 <farenheit@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xebe(%rip),%rdi
call   1030 <puts@plt>
lea    0xeac(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x2,%eax
je     1197 <main+0x57>
cmp    $0x1,%eax
jne    11be <main+0x7e>
lea    0xf02(%rip),%rdi
call   1030 <puts@plt>
lea    0xe82(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movss  (%rsp),%xmm0
call   1060 <celsius@plt>
jmp    11be <main+0x7e>
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
lea    0xe59(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movss  (%rsp),%xmm0
call   1040 <farenheit@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [97 x i8] c"digite 1 para converter de farenheit para celsius e 2 para converter de celsius para farenheit:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [18 x i8] c"temperatura F\C2\B0:\0A\00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [18 x i8] c"temperatura C\C2\B0:\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 @printf(i8* getelementptr inbounds ([97 x i8], [97 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%10 = load i32, i32* %6
switch i32 %10, label %21 [
i32 1, label %11
i32 2, label %16
]
11: ; preds = %2
%12 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %7)
%14 = load float, float* %7
%15 = call i32 @celsius(float %14)
br label %21
16: ; preds = %2
%17 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %7)
%19 = load float, float* %7
%20 = call i32 @farenheit(float %19)
br label %21
21: ; preds = %2, %16, %11
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [3 x i8] c"%f\00"
@str = [96 x i8] c"digite 1 para converter de farenheit para celsius e 2 para converter de celsius para farenheit:\00"
@str.5 = [17 x i8] c"temperatura C\C2\B0:\00"
@str.6 = [17 x i8] c"temperatura F\C2\B0:\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca float
%5 = bitcast i32* %3 to i8*
%6 = bitcast float* %4 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([96 x i8], [96 x i8]* @str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%9 = load i32, i32* %3
switch i32 %9, label %20 [
i32 1, label %10
i32 2, label %15
]
10: ; preds = %2
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.6, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %4)
%13 = load float, float* %4
%14 = call i32 @celsius(float %13)
br label %20
15: ; preds = %2
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 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* %4)
%18 = load float, float* %4
%19 = call i32 @farenheit(float %18)
br label %20
20: ; preds = %2, %15, %10
ret i32 0
}