float t_conv(float *temp, int *temp_type) {
  float value;
  if (*temp_type == 'C') {
    value = (*temp * (9.0 / 5.0)) + 32.0;
    *temp_type = 'F';
  } else if (*temp_type == 'F') {
    value = (5.0 / 9.0) * (*temp - 32.0);
    *temp_type = 'C';
  }
  return value;
}


x86 assembly (clang, -O0):
<t_conv>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0x43,(%rax)
jne    1155 <t_conv+0x55>
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xee3(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xecf(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x46,(%rax)
jmp    119e <t_conv+0x9e>
mov    -0x10(%rbp),%rax
cmpl   $0x46,(%rax)
jne    1199 <t_conv+0x99>
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe92(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xe7e(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x43,(%rax)
jmp    119e <t_conv+0x9e>
movss  -0x14(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_conv>:
mov    (%rsi),%eax
cmp    $0x46,%eax
je     112b <t_conv+0x2b>
cmp    $0x43,%eax
jne    114e <t_conv+0x4e>
movss  (%rdi),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xef4(%rip),%xmm0
addsd  0xef4(%rip),%xmm0
mov    $0x46,%eax
jmp    1148 <t_conv+0x48>
movss  (%rdi),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  0xec5(%rip),%xmm0
mulsd  0xec5(%rip),%xmm0
mov    $0x43,%eax
cvtsd2ss %xmm0,%xmm0
mov    %eax,(%rsi)
ret

LLVM IR (-O0):
define float @t_conv(float* %0, i32* %1) {
%3 = alloca float*
%4 = alloca i32*
%5 = alloca float
store float* %0, float** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %4
%7 = load i32, i32* %6
%8 = icmp eq i32 %7, 67
br i1 %8, label %9, label %16
9: ; preds = %2
%10 = load float*, float** %3
%11 = load float, float* %10
%12 = fpext float %11 to double
%13 = call double @llvm.fmuladd.f64(double %12, double 1.800000e+00, double 3.200000e+01)
%14 = fptrunc double %13 to float
store float %14, float* %5
%15 = load i32*, i32** %4
store i32 70, i32* %15
br label %29
16: ; preds = %2
%17 = load i32*, i32** %4
%18 = load i32, i32* %17
%19 = icmp eq i32 %18, 70
br i1 %19, label %20, label %28
20: ; preds = %16
%21 = load float*, float** %3
%22 = load float, float* %21
%23 = fpext float %22 to double
%24 = fsub double %23, 3.200000e+01
%25 = fmul double 0x3FE1C71C71C71C72, %24
%26 = fptrunc double %25 to float
store float %26, float* %5
%27 = load i32*, i32** %4
store i32 67, i32* %27
br label %28
28: ; preds = %20, %16
br label %29
29: ; preds = %28, %9
%30 = load float, float* %5
ret float %30
}

LLVM IR (-O2):
define float @t_conv(float* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %1
switch i32 %3, label %17 [
i32 67, label %4
i32 70, label %8
]
4: ; preds = %2
%5 = load float, float* %0
%6 = fpext float %5 to double
%7 = tail call double @llvm.fmuladd.f64(double %6, double 1.800000e+00, double 3.200000e+01)
br label %13
8: ; preds = %2
%9 = load float, float* %0
%10 = fpext float %9 to double
%11 = fadd double %10, -3.200000e+01
%12 = fmul double %11, 0x3FE1C71C71C71C72
br label %13
13: ; preds = %4, %8
%14 = phi double [ %12, %8 ], [ %7, %4 ]
%15 = phi i32 [ 67, %8 ], [ 70, %4 ]
%16 = fptrunc double %14 to float
store i32 %15, i32* %1
br label %17
17: ; preds = %13, %2
%18 = phi float [ undef, %2 ], [ %16, %13 ]
ret float %18
}