#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*/ mesh_error(int);
double __mesh_convert_format_float_0(int dtype, char *in) {
  switch (dtype) {
  case 6:
  case 7:
    return *((float *)in);
  case 8:
    return *((double *)in);
  default:
    mesh_error(4);
  }
  return -1;
}


x86 assembly (clang, -O0):
<__mesh_convert_format_float_0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
add    $0xfffffffa,%eax
sub    $0x2,%eax
jb     1147 <__mesh_convert_format_float_0+0x37>
jmp    1136 <__mesh_convert_format_float_0+0x26>
mov    -0x1c(%rbp),%eax
sub    $0x8,%eax
je     115d <__mesh_convert_format_float_0+0x4d>
jmp    116f <__mesh_convert_format_float_0+0x5f>
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1186 <__mesh_convert_format_float_0+0x76>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1186 <__mesh_convert_format_float_0+0x76>
mov    $0x4,%edi
call   1030 <mesh_error@plt>
movsd  0xe7f(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__mesh_convert_format_float_0>:
push   %rax
lea    -0x6(%rdi),%eax
cmp    $0x2,%eax
jae    1123 <__mesh_convert_format_float_0+0x13>
movss  (%rsi),%xmm0
cvtss2sd %xmm0,%xmm0
pop    %rax
ret
cmp    $0x8,%edi
jne    112e <__mesh_convert_format_float_0+0x1e>
movsd  (%rsi),%xmm0
pop    %rax
ret
mov    $0x4,%edi
call   1030 <mesh_error@plt>
movsd  0xec0(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @__mesh_convert_format_float_0(i32 %0, i8* %1) {
%3 = alloca double
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
%6 = load i32, i32* %4
switch i32 %6, label %16 [
i32 6, label %7
i32 7, label %7
i32 8, label %12
]
7: ; preds = %2, %2
%8 = load i8*, i8** %5
%9 = bitcast i8* %8 to float*
%10 = load float, float* %9
%11 = fpext float %10 to double
store double %11, double* %3
br label %19
12: ; preds = %2
%13 = load i8*, i8** %5
%14 = bitcast i8* %13 to double*
%15 = load double, double* %14
store double %15, double* %3
br label %19
16: ; preds = %2
%17 = call i32 @mesh_error(i32 4)
br label %18
18: ; preds = %16
store double -1.000000e+00, double* %3
br label %19
19: ; preds = %18, %12, %7
%20 = load double, double* %3
ret double %20
}

LLVM IR (-O2):
define double @__mesh_convert_format_float_0(i32 %0, i8* nocapture %1) {
switch i32 %0, label %10 [
i32 6, label %3
i32 7, label %3
i32 8, label %7
]
3: ; preds = %2, %2
%4 = bitcast i8* %1 to float*
%5 = load float, float* %4
%6 = fpext float %5 to double
br label %12
7: ; preds = %2
%8 = bitcast i8* %1 to double*
%9 = load double, double* %8
br label %12
10: ; preds = %2
%11 = tail call i32 @mesh_error(i32 4)
br label %12
12: ; preds = %10, %7, %3
%13 = phi double [ -1.000000e+00, %10 ], [ %9, %7 ], [ %6, %3 ]
ret double %13
}