#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 *);
int main() {
  int option;
  int firstOption;
  printf("\nCONNECT XZ\nTEMPERATURE CONVERSOR::1.0\n\nCHOOSE THE NUMBER OF "
         "CONVERSION\n\n1.CONVERT FAHRENHEIT TO CELSIUS\n2. CONVERT CELSIUS TO "
         "FAHRENHEIT\n");
  scanf("%i", &option);
  if (option == 1) {
    printf("\nPLEASE, ENTER THE DEGREE THAT YOU WANT TO CONVERT\n");
    scanf("%i", &firstOption);
    int calcFirst = (firstOption - 32) / 1.8;
    printf("%i DEGREES CELSIUS\n", calcFirst);
  } else if (option == 2) {
    printf("\nPLEASE, ENTER THE DEGREE THAT YOU WANT TO CONVERT\n");
    scanf("%i", &firstOption);
    int calcSecond = firstOption * 1.8 + 32;
    printf("%i FAHRENHEIT\n\n", calcSecond);
  }
  printf("\nTO RETURN PLEASE RESTART THE PROGRAM, ELSE YOU CAN GO AND HAVE "
         "FUN\n\nCONNECT XZ OFFICIAL PRODUCT\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf57(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0x8(%rbp)
jne    11a8 <main+0x88>
lea    0xf40(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf2f(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
sub    $0x20,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe79(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xf36(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    120a <main+0xea>
cmpl   $0x2,-0x8(%rbp)
jne    1205 <main+0xe5>
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xe23(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe1f(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xee8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    120a <main+0xea>
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeff(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x2,%eax
je     1192 <main+0x62>
cmp    $0x1,%eax
jne    11d4 <main+0xa4>
lea    0xfc0(%rip),%rdi
call   1030 <puts@plt>
lea    0xea1(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%eax
add    $0xffffffe0,%eax
cvtsi2sd %eax,%xmm0
divsd  0xe77(%rip),%xmm0
lea    0xe83(%rip),%rdi
jmp    11c9 <main+0x99>
lea    0xf8a(%rip),%rdi
call   1030 <puts@plt>
lea    0xe6b(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
cvtsi2sdl (%rsp),%xmm0
mulsd  0xe46(%rip),%xmm0
addsd  0xe46(%rip),%xmm0
lea    0xe5e(%rip),%rdi
cvttsd2si %xmm0,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee6(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [139 x i8] c"\0ACONNECT XZ\0ATEMPERATURE CONVERSOR::1.0\0A\0ACHOOSE THE NUMBER OF CONVERSION\0A\0A1.CONVERT FAHRENHEIT TO CELSIUS\0A2. CONVERT CELSIUS TO FAHRENHEIT\0A\00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [52 x i8] c"\0APLEASE, ENTER THE DEGREE THAT YOU WANT TO CONVERT\0A\00"
@.str.3 = [20 x i8] c"%i DEGREES CELSIUS\0A\00"
@.str.4 = [16 x i8] c"%i FAHRENHEIT\0A\0A\00"
@.str.5 = [99 x i8] c"\0ATO RETURN PLEASE RESTART THE PROGRAM, ELSE YOU CAN GO AND HAVE FUN\0A\0ACONNECT XZ OFFICIAL PRODUCT\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %20
10: ; preds = %0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%13 = load i32, i32* %3
%14 = sub nsw i32 %13, 32
%15 = sitofp i32 %14 to double
%16 = fdiv double %15, 1.800000e+00
%17 = fptosi double %16 to i32
store i32 %17, i32* %4
%18 = load i32, i32* %4
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %18)
br label %33
20: ; preds = %0
%21 = load i32, i32* %2
%22 = icmp eq i32 %21, 2
br i1 %22, label %23, label %32
23: ; preds = %20
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0))
%25 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%26 = load i32, i32* %3
%27 = sitofp i32 %26 to double
%28 = call double @llvm.fmuladd.f64(double %27, double 1.800000e+00, double 3.200000e+01)
%29 = fptosi double %28 to i32
store i32 %29, i32* %5
%30 = load i32, i32* %5
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %23, %20
br label %33
33: ; preds = %32, %10
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([99 x i8], [99 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%i\00"
@.str.3 = [20 x i8] c"%i DEGREES CELSIUS\0A\00"
@.str.4 = [16 x i8] c"%i FAHRENHEIT\0A\0A\00"
@str = [138 x i8] c"\0ACONNECT XZ\0ATEMPERATURE CONVERSOR::1.0\0A\0ACHOOSE THE NUMBER OF CONVERSION\0A\0A1.CONVERT FAHRENHEIT TO CELSIUS\0A2. CONVERT CELSIUS TO FAHRENHEIT\00"
@str.6 = [98 x i8] c"\0ATO RETURN PLEASE RESTART THE PROGRAM, ELSE YOU CAN GO AND HAVE FUN\0A\0ACONNECT XZ OFFICIAL PRODUCT\0A\00"
@str.8 = [51 x i8] c"\0APLEASE, ENTER THE DEGREE THAT YOU WANT TO CONVERT\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([138 x i8], [138 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), i32* %1)
%7 = load i32, i32* %1
switch i32 %7, label %26 [
i32 1, label %8
i32 2, label %15
]
8: ; preds = %0
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.8, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %2
%12 = add nsw i32 %11, -32
%13 = sitofp i32 %12 to double
%14 = fdiv double %13, 1.800000e+00
br label %21
15: ; preds = %0
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.8, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%18 = load i32, i32* %2
%19 = sitofp i32 %18 to double
%20 = call double @llvm.fmuladd.f64(double %19, double 1.800000e+00, double 3.200000e+01)
br label %21
21: ; preds = %8, %15
%22 = phi double [ %20, %15 ], [ %14, %8 ]
%23 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), %15 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), %8 ]
%24 = fptosi double %22 to i32
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %23, i32 %24)
br label %26
26: ; preds = %21, %0
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([98 x i8], [98 x i8]* @str.6, i64 0, i64 0))
ret i32 0
}