#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 */
char cMay(char);
double convertir(char, float);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ stdin;
int strlen(char *);
main() {
  char nombre[10];
  fgets(nombre, 10, stdin);
  int i;
  for (i = 0; i < strlen(nombre); i++) {
    nombre[i] = cMay(nombre[i]);
  }
  printf("%s\n", nombre);
  char tipo;
  float temperatura;
  printf(
      "que tipo de temperatura quiere cambiar 'c' Celsius o 'f' Farenheit\n");
  scanf("%s", &tipo);
  printf("Ingrese temperatura en %s° \n", &tipo);
  scanf("%f", &temperatura);
  printf(" %s %.0f° es %.0f° \n", &tipo, temperatura,
         convertir(tipo, temperatura));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xe(%rbp),%rdi
mov    0x2e6e(%rip),%rax
mov    (%rax),%edx
mov    $0xa,%esi
call   1060 <fgets@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
lea    -0xe(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cmp    %ecx,%eax
jge    11cf <main+0x6f>
movslq -0x14(%rbp),%rax
movsbl -0xe(%rbp,%rax,1),%edi
call   1080 <cMay@plt>
mov    %al,%cl
movslq -0x14(%rbp),%rax
mov    %cl,-0xe(%rbp,%rax,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    118d <main+0x2d>
lea    -0xe(%rbp),%rsi
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe52(%rip),%rdi
lea    -0x15(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    0xe43(%rip),%rdi
lea    -0x15(%rbp),%rsi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe4f(%rip),%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x15(%rbp),%al
movss  -0x1c(%rbp),%xmm0
movsbl %al,%edi
call   1030 <convertir@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
lea    0xe1a(%rip),%rdi
lea    -0x15(%rbp),%rsi
mov    $0x2,%al
call   1050 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    0x2e6a(%rip),%rax
mov    (%rax),%edx
lea    0x16(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1070 <fgets@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
jle    11d1 <main+0x61>
xor    %ebx,%ebx
lea    0x16(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
nop
movsbl 0x16(%rsp,%rbx,1),%edi
call   1090 <cMay@plt>
mov    %al,0x16(%rsp,%rbx,1)
add    $0x1,%rbx
mov    %r14,%rdi
call   1050 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     11b0 <main+0x40>
lea    0x16(%rsp),%rdi
call   1040 <puts@plt>
lea    0xe59(%rip),%rdi
call   1040 <puts@plt>
lea    0xe12(%rip),%rdi
lea    0xf(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
lea    0xdff(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe0c(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  %xmm1,0x20(%rsp)
movsbl 0xf(%rsp),%edi
call   1030 <convertir@plt>
movaps %xmm0,%xmm1
lea    0xddf(%rip),%rdi
mov    %rbx,%rsi
movsd  0x20(%rsp),%xmm0
mov    $0x2,%al
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [68 x i8] c"que tipo de temperatura quiere cambiar 'c' Celsius o 'f' Farenheit\0A\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [30 x i8] c"Ingrese temperatura en %s\C2\B0 \0A\00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [23 x i8] c" %s %.0f\C2\B0 es %.0f\C2\B0 \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = alloca i32
%4 = alloca i8
%5 = alloca float
store i32 0, i32* %1
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%7 = load i32, i32* @stdin
%8 = call i32 @fgets(i8* %6, i32 10, i32 %7)
store i32 0, i32* %3
br label %9
9: ; preds = %23, %0
%10 = load i32, i32* %3
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%12 = call i32 @strlen(i8* %11)
%13 = icmp slt i32 %10, %12
br i1 %13, label %14, label %26
14: ; preds = %9
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = call signext i8 @cMay(i8 signext %18)
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 %21
store i8 %19, i8* %22
br label %23
23: ; preds = %14
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %9
26: ; preds = %9
%27 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %27)
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.1, i64 0, i64 0))
%30 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%32 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %5)
%33 = load float, float* %5
%34 = fpext float %33 to double
%35 = load i8, i8* %4
%36 = load float, float* %5
%37 = call double @convertir(i8 signext %35, float %36)
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %4, double %34, double %37)
%39 = load i32, i32* %1
ret i32 %39
}

LLVM IR (-O2):
@stdin = global i32 0
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [30 x i8] c"Ingrese temperatura en %s\C2\B0 \0A\00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [23 x i8] c" %s %.0f\C2\B0 es %.0f\C2\B0 \0A\00"
@str = [67 x i8] c"que tipo de temperatura quiere cambiar 'c' Celsius o 'f' Farenheit\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = alloca i8
%3 = alloca float
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i32 @fgets(i8* %4, i32 10, i32 %5)
%7 = call i32 @strlen(i8* %4)
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %18
9: ; preds = %0, %9
%10 = phi i64 [ %14, %9 ], [ 0, %0 ]
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = call signext i8 @cMay(i8 signext %12)
store i8 %13, i8* %11
%14 = add nuw nsw i64 %10, 1
%15 = call i32 @strlen(i8* %4)
%16 = sext i32 %15 to i64
%17 = icmp slt i64 %14, %16
br i1 %17, label %9, label %18
18: ; preds = %9, %0
%19 = call i32 @puts(i8* %4)
%20 = bitcast float* %3 to i8*
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @str, i64 0, i64 0))
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%24 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %3)
%25 = load float, float* %3
%26 = fpext float %25 to double
%27 = load i8, i8* %2
%28 = call double @convertir(i8 signext %27, float %25)
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %2, double %26, double %28)
ret i32 0
}