#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 */
typedef int uint32_t;
typedef int /*<<< orphan*/ names;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stderr;
const char *pn_binop_get_name_float(uint32_t op) {
  const char *names[] = {"fadd", "fsub", "fmul", NULL, "fdiv", NULL, NULL,
                         NULL,   NULL,   NULL,   NULL, NULL,   NULL};
  if (op >= (sizeof(names) / sizeof((names)[0]))) {
    do {
      fprintf(stderr, "Invalid op: %u\n", op);
      exit(1);
    } while (0);
  }
  const char *name = names[op];
  if (!name) {
    do {
      fprintf(stderr, "Invalid float binop: %u\n", op);
      exit(1);
    } while (0);
  }
  return name;
}


x86 assembly (clang, -O0):
<pn_binop_get_name_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x68,%edx
call   1030 <memset@plt>
lea    0xeab(%rip),%rax
mov    %rax,-0x70(%rbp)
lea    0xea5(%rip),%rax
mov    %rax,-0x68(%rbp)
lea    0xe9f(%rip),%rax
mov    %rax,-0x60(%rbp)
lea    0xe99(%rip),%rax
mov    %rax,-0x50(%rbp)
movslq -0x4(%rbp),%rax
cmp    $0xd,%rax
jb     11af <pn_binop_get_name_float+0x7f>
jmp    118d <pn_binop_get_name_float+0x5d>
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xe74(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
movslq -0x4(%rbp),%rax
mov    -0x70(%rbp,%rax,8),%rax
mov    %rax,-0x78(%rbp)
cmpq   $0x0,-0x78(%rbp)
jne    11ee <pn_binop_get_name_float+0xbe>
jmp    11cc <pn_binop_get_name_float+0x9c>
mov    0x2e0d(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xe45(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x78(%rbp),%rax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pn_binop_get_name_float>:
sub    $0x68,%rsp
mov    %edi,%edx
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movq   $0x0,0x60(%rsp)
lea    0xeae(%rip),%rax
mov    %rax,(%rsp)
lea    0xea8(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0xea1(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xe9a(%rip),%rax
mov    %rax,0x20(%rsp)
cmp    $0xd,%edi
jae    118f <pn_binop_get_name_float+0x6f>
mov    %edx,%eax
mov    (%rsp,%rax,8),%rax
test   %rax,%rax
je     11a1 <pn_binop_get_name_float+0x81>
add    $0x68,%rsp
ret
mov    0x2e4a(%rip),%rax
mov    (%rax),%edi
lea    0xe75(%rip),%rsi
jmp    11b1 <pn_binop_get_name_float+0x91>
mov    0x2e38(%rip),%rax
mov    (%rax),%edi
lea    0xe73(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"fadd\00"
@.str.1 = [5 x i8] c"fsub\00"
@.str.2 = [5 x i8] c"fmul\00"
@.str.3 = [5 x i8] c"fdiv\00"
@stderr = global i32 0
@.str.4 = [16 x i8] c"Invalid op: %u\0A\00"
@.str.5 = [25 x i8] c"Invalid float binop: %u\0A\00"
define i8* @pn_binop_get_name_float(i32 %0) {
%2 = alloca i32
%3 = alloca [13 x i8*]
%4 = alloca i8*
store i32 %0, i32* %2
%5 = bitcast [13 x i8*]* %3 to i8*
%6 = bitcast i8* %5 to <{ i8*, i8*, i8*, i8*, i8*, [8 x i8*] }>*
%7 = getelementptr inbounds <{ i8*, i8*, i8*, i8*, i8*, [8 x i8*] }>, <{ i8*, i8*, i8*, i8*, i8*, [8 x i8*] }>* %6, i32 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8** %7
%8 = getelementptr inbounds <{ i8*, i8*, i8*, i8*, i8*, [8 x i8*] }>, <{ i8*, i8*, i8*, i8*, i8*, [8 x i8*] }>* %6, i32 0, i32 1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8** %8
%9 = getelementptr inbounds <{ i8*, i8*, i8*, i8*, i8*, [8 x i8*] }>, <{ i8*, i8*, i8*, i8*, i8*, [8 x i8*] }>* %6, i32 0, i32 2
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8** %9
%10 = getelementptr inbounds <{ i8*, i8*, i8*, i8*, i8*, [8 x i8*] }>, <{ i8*, i8*, i8*, i8*, i8*, [8 x i8*] }>* %6, i32 0, i32 4
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0), i8** %10
%11 = load i32, i32* %2
%12 = sext i32 %11 to i64
%13 = icmp uge i64 %12, 13
br i1 %13, label %14, label %21
14: ; preds = %1
br label %15
15: ; preds = %14
%16 = load i32, i32* @stderr
%17 = load i32, i32* %2
%18 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %17)
%19 = call i32 @exit(i32 1)
unreachable
20: ; No predecessors!
br label %21
21: ; preds = %20, %1
%22 = load i32, i32* %2
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [13 x i8*], [13 x i8*]* %3, i64 0, i64 %23
%25 = load i8*, i8** %24
store i8* %25, i8** %4
%26 = load i8*, i8** %4
%27 = icmp ne i8* %26, null
br i1 %27, label %35, label %28
28: ; preds = %21
br label %29
29: ; preds = %28
%30 = load i32, i32* @stderr
%31 = load i32, i32* %2
%32 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32 %31)
%33 = call i32 @exit(i32 1)
unreachable
34: ; No predecessors!
br label %35
35: ; preds = %34, %21
%36 = load i8*, i8** %4
ret i8* %36
}

LLVM IR (-O2):
@.str = [5 x i8] c"fadd\00"
@.str.1 = [5 x i8] c"fsub\00"
@.str.2 = [5 x i8] c"fmul\00"
@.str.3 = [5 x i8] c"fdiv\00"
@stderr = global i32 0
@.str.4 = [16 x i8] c"Invalid op: %u\0A\00"
@.str.5 = [25 x i8] c"Invalid float binop: %u\0A\00"
define i8* @pn_binop_get_name_float(i32 %0) {
%2 = alloca [13 x i8*]
%3 = bitcast [13 x i8*]* %2 to i8*
%4 = getelementptr inbounds [13 x i8*], [13 x i8*]* %2, i64 0, i64 2
%5 = bitcast i8** %4 to i8*
%6 = getelementptr inbounds [13 x i8*], [13 x i8*]* %2, i64 0, i64 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %6
%7 = getelementptr inbounds [13 x i8*], [13 x i8*]* %2, i64 0, i64 1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %7
%8 = getelementptr inbounds [13 x i8*], [13 x i8*]* %2, i64 0, i64 2
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %8
%9 = getelementptr inbounds [13 x i8*], [13 x i8*]* %2, i64 0, i64 4
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8** %9
%10 = icmp ugt i32 %0, 12
br i1 %10, label %11, label %15
11: ; preds = %1
%12 = load i32, i32* @stderr
%13 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %0)
%14 = tail call i32 @exit(i32 1)
unreachable
15: ; preds = %1
%16 = zext i32 %0 to i64
%17 = getelementptr inbounds [13 x i8*], [13 x i8*]* %2, i64 0, i64 %16
%18 = load i8*, i8** %17
%19 = icmp eq i8* %18, null
br i1 %19, label %20, label %24
20: ; preds = %15
%21 = load i32, i32* @stderr
%22 = tail call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32 %0)
%23 = tail call i32 @exit(i32 1)
unreachable
24: ; preds = %15
ret i8* %18
}