#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*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
int datatype2str(int datatype, char *datatypestr) {
  int status = 0;
  if (datatype == 0)
    strcpy(datatypestr, "P0");
  else if (datatype > 0 && datatype <= 32)
    sprintf(datatypestr, "P%d", datatype);
  else if (datatype == 64)
    strcpy(datatypestr, "C32");
  else if (datatype == 128)
    strcpy(datatypestr, "C64");
  else if (datatype == 132)
    strcpy(datatypestr, "F32");
  else if (datatype == 164)
    strcpy(datatypestr, "F64");
  else if (datatype == 208)
    strcpy(datatypestr, "I8");
  else if (datatype == 216)
    strcpy(datatypestr, "I16");
  else if (datatype == 232)
    strcpy(datatypestr, "I32");
  else if (datatype == 308)
    strcpy(datatypestr, "U8");
  else if (datatype == 316)
    strcpy(datatypestr, "U16");
  else if (datatype == 332)
    strcpy(datatypestr, "U32");
  else {
    strcpy(datatypestr, "-1");
    status = -1;
  }
  return (status);
}


x86 assembly (clang, -O0):
<datatype2str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1155 <datatype2str+0x35>
mov    -0x10(%rbp),%rdi
lea    0xeb5(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1320 <datatype2str+0x200>
cmpl   $0x0,-0x4(%rbp)
jle    1181 <datatype2str+0x61>
cmpl   $0x20,-0x4(%rbp)
jg     1181 <datatype2str+0x61>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xe8c(%rip),%rsi
call   1040 <sprintf@plt>
jmp    131b <datatype2str+0x1fb>
cmpl   $0x40,-0x4(%rbp)
jne    11a0 <datatype2str+0x80>
mov    -0x10(%rbp),%rdi
lea    0xe71(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1316 <datatype2str+0x1f6>
cmpl   $0x80,-0x4(%rbp)
jne    11c2 <datatype2str+0xa2>
mov    -0x10(%rbp),%rdi
lea    0xe53(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1311 <datatype2str+0x1f1>
cmpl   $0x84,-0x4(%rbp)
jne    11e4 <datatype2str+0xc4>
mov    -0x10(%rbp),%rdi
lea    0xe35(%rip),%rsi
call   1030 <strcpy@plt>
jmp    130c <datatype2str+0x1ec>
cmpl   $0xa4,-0x4(%rbp)
jne    1206 <datatype2str+0xe6>
mov    -0x10(%rbp),%rdi
lea    0xe17(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1307 <datatype2str+0x1e7>
cmpl   $0xd0,-0x4(%rbp)
jne    1228 <datatype2str+0x108>
mov    -0x10(%rbp),%rdi
lea    0xdf9(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1302 <datatype2str+0x1e2>
cmpl   $0xd8,-0x4(%rbp)
jne    124a <datatype2str+0x12a>
mov    -0x10(%rbp),%rdi
lea    0xdda(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12fd <datatype2str+0x1dd>
cmpl   $0xe8,-0x4(%rbp)
jne    126c <datatype2str+0x14c>
mov    -0x10(%rbp),%rdi
lea    0xdbc(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12f8 <datatype2str+0x1d8>
cmpl   $0x134,-0x4(%rbp)
jne    128e <datatype2str+0x16e>
mov    -0x10(%rbp),%rdi
lea    0xd9e(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12f3 <datatype2str+0x1d3>
cmpl   $0x13c,-0x4(%rbp)
jne    12b0 <datatype2str+0x190>
mov    -0x10(%rbp),%rdi
lea    0xd7f(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12ee <datatype2str+0x1ce>
cmpl   $0x14c,-0x4(%rbp)
jne    12d2 <datatype2str+0x1b2>
mov    -0x10(%rbp),%rdi
lea    0xd61(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12e9 <datatype2str+0x1c9>
mov    -0x10(%rbp),%rdi
lea    0xd50(%rip),%rsi
call   1030 <strcpy@plt>
movl   $0xffffffff,-0x14(%rbp)
jmp    12ee <datatype2str+0x1ce>
jmp    12f3 <datatype2str+0x1d3>
jmp    12f8 <datatype2str+0x1d8>
jmp    12fd <datatype2str+0x1dd>
jmp    1302 <datatype2str+0x1e2>
jmp    1307 <datatype2str+0x1e7>
jmp    130c <datatype2str+0x1ec>
jmp    1311 <datatype2str+0x1f1>
jmp    1316 <datatype2str+0x1f6>
jmp    131b <datatype2str+0x1fb>
jmp    1320 <datatype2str+0x200>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<datatype2str>:
push   %rax
test   %edi,%edi
je     1143 <datatype2str+0x23>
mov    %edi,%edx
lea    -0x1(%rdx),%eax
cmp    $0x1f,%eax
ja     1159 <datatype2str+0x39>
lea    0xecd(%rip),%rax
mov    %rsi,%rdi
mov    %rax,%rsi
call   1040 <sprintf@plt>
jmp    1155 <datatype2str+0x35>
lea    0xeb6(%rip),%rax
mov    %rsi,%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
xor    %eax,%eax
pop    %rcx
ret
cmp    $0xd7,%edx
jg     1196 <datatype2str+0x76>
cmp    $0x83,%edx
jle    11c3 <datatype2str+0xa3>
cmp    $0x84,%edx
je     11f8 <datatype2str+0xd8>
cmp    $0xa4,%edx
je     1204 <datatype2str+0xe4>
cmp    $0xd0,%edx
jne    1240 <datatype2str+0x120>
lea    0xe83(%rip),%rax
jmp    114a <datatype2str+0x2a>
cmp    $0x133,%edx
jle    11dc <datatype2str+0xbc>
cmp    $0x134,%edx
je     1210 <datatype2str+0xf0>
cmp    $0x13c,%edx
je     121c <datatype2str+0xfc>
cmp    $0x14c,%edx
jne    1240 <datatype2str+0x120>
lea    0xe68(%rip),%rax
jmp    114a <datatype2str+0x2a>
cmp    $0x40,%edx
je     1228 <datatype2str+0x108>
cmp    $0x80,%edx
jne    1240 <datatype2str+0x120>
lea    0xe34(%rip),%rax
jmp    114a <datatype2str+0x2a>
cmp    $0xd8,%edx
je     1234 <datatype2str+0x114>
cmp    $0xe8,%edx
jne    1240 <datatype2str+0x120>
lea    0xe2b(%rip),%rax
jmp    114a <datatype2str+0x2a>
lea    0xe10(%rip),%rax
jmp    114a <datatype2str+0x2a>
lea    0xe08(%rip),%rax
jmp    114a <datatype2str+0x2a>
lea    0xe0b(%rip),%rax
jmp    114a <datatype2str+0x2a>
lea    0xe02(%rip),%rax
jmp    114a <datatype2str+0x2a>
lea    0xdd8(%rip),%rax
jmp    114a <datatype2str+0x2a>
lea    0xddf(%rip),%rax
jmp    114a <datatype2str+0x2a>
lea    0xde6(%rip),%rax
mov    %rsi,%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"P0\00"
@.str.1 = [4 x i8] c"P%d\00"
@.str.2 = [4 x i8] c"C32\00"
@.str.3 = [4 x i8] c"C64\00"
@.str.4 = [4 x i8] c"F32\00"
@.str.5 = [4 x i8] c"F64\00"
@.str.6 = [3 x i8] c"I8\00"
@.str.7 = [4 x i8] c"I16\00"
@.str.8 = [4 x i8] c"I32\00"
@.str.9 = [3 x i8] c"U8\00"
@.str.10 = [4 x i8] c"U16\00"
@.str.11 = [4 x i8] c"U32\00"
@.str.12 = [3 x i8] c"-1\00"
define i32 @datatype2str(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
store i32 0, i32* %5
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i8*, i8** %4
%10 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %95
11: ; preds = %2
%12 = load i32, i32* %3
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %21
14: ; preds = %11
%15 = load i32, i32* %3
%16 = icmp sle i32 %15, 32
br i1 %16, label %17, label %21
17: ; preds = %14
%18 = load i8*, i8** %4
%19 = load i32, i32* %3
%20 = call i32 @sprintf(i8* %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %19)
br label %94
21: ; preds = %14, %11
%22 = load i32, i32* %3
%23 = icmp eq i32 %22, 64
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = load i8*, i8** %4
%26 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %93
27: ; preds = %21
%28 = load i32, i32* %3
%29 = icmp eq i32 %28, 128
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = load i8*, i8** %4
%32 = call i32 @strcpy(i8* %31, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %92
33: ; preds = %27
%34 = load i32, i32* %3
%35 = icmp eq i32 %34, 132
br i1 %35, label %36, label %39
36: ; preds = %33
%37 = load i8*, i8** %4
%38 = call i32 @strcpy(i8* %37, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %91
39: ; preds = %33
%40 = load i32, i32* %3
%41 = icmp eq i32 %40, 164
br i1 %41, label %42, label %45
42: ; preds = %39
%43 = load i8*, i8** %4
%44 = call i32 @strcpy(i8* %43, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
br label %90
45: ; preds = %39
%46 = load i32, i32* %3
%47 = icmp eq i32 %46, 208
br i1 %47, label %48, label %51
48: ; preds = %45
%49 = load i8*, i8** %4
%50 = call i32 @strcpy(i8* %49, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %89
51: ; preds = %45
%52 = load i32, i32* %3
%53 = icmp eq i32 %52, 216
br i1 %53, label %54, label %57
54: ; preds = %51
%55 = load i8*, i8** %4
%56 = call i32 @strcpy(i8* %55, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
br label %88
57: ; preds = %51
%58 = load i32, i32* %3
%59 = icmp eq i32 %58, 232
br i1 %59, label %60, label %63
60: ; preds = %57
%61 = load i8*, i8** %4
%62 = call i32 @strcpy(i8* %61, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
br label %87
63: ; preds = %57
%64 = load i32, i32* %3
%65 = icmp eq i32 %64, 308
br i1 %65, label %66, label %69
66: ; preds = %63
%67 = load i8*, i8** %4
%68 = call i32 @strcpy(i8* %67, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
br label %86
69: ; preds = %63
%70 = load i32, i32* %3
%71 = icmp eq i32 %70, 316
br i1 %71, label %72, label %75
72: ; preds = %69
%73 = load i8*, i8** %4
%74 = call i32 @strcpy(i8* %73, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
br label %85
75: ; preds = %69
%76 = load i32, i32* %3
%77 = icmp eq i32 %76, 332
br i1 %77, label %78, label %81
78: ; preds = %75
%79 = load i8*, i8** %4
%80 = call i32 @strcpy(i8* %79, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
br label %84
81: ; preds = %75
%82 = load i8*, i8** %4
%83 = call i32 @strcpy(i8* %82, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0))
store i32 -1, i32* %5
br label %84
84: ; preds = %81, %78
br label %85
85: ; preds = %84, %72
br label %86
86: ; preds = %85, %66
br label %87
87: ; preds = %86, %60
br label %88
88: ; preds = %87, %54
br label %89
89: ; preds = %88, %48
br label %90
90: ; preds = %89, %42
br label %91
91: ; preds = %90, %36
br label %92
92: ; preds = %91, %30
br label %93
93: ; preds = %92, %24
br label %94
94: ; preds = %93, %17
br label %95
95: ; preds = %94, %8
%96 = load i32, i32* %5
ret i32 %96
}

LLVM IR (-O2):
@.str = [3 x i8] c"P0\00"
@.str.1 = [4 x i8] c"P%d\00"
@.str.2 = [4 x i8] c"C32\00"
@.str.3 = [4 x i8] c"C64\00"
@.str.4 = [4 x i8] c"F32\00"
@.str.5 = [4 x i8] c"F64\00"
@.str.6 = [3 x i8] c"I8\00"
@.str.7 = [4 x i8] c"I16\00"
@.str.8 = [4 x i8] c"I32\00"
@.str.9 = [3 x i8] c"U8\00"
@.str.10 = [4 x i8] c"U16\00"
@.str.11 = [4 x i8] c"U32\00"
@.str.12 = [3 x i8] c"-1\00"
define i32 @datatype2str(i32 %0, i8* %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %34
6: ; preds = %2
%7 = add i32 %0, -1
%8 = icmp ult i32 %7, 32
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = tail call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %0)
br label %34
11: ; preds = %6
switch i32 %0, label %32 [
i32 64, label %12
i32 128, label %14
i32 132, label %16
i32 164, label %18
i32 208, label %20
i32 216, label %22
i32 232, label %24
i32 308, label %26
i32 316, label %28
i32 332, label %30
]
12: ; preds = %11
%13 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %34
14: ; preds = %11
%15 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %34
16: ; preds = %11
%17 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %34
18: ; preds = %11
%19 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
br label %34
20: ; preds = %11
%21 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %34
22: ; preds = %11
%23 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
br label %34
24: ; preds = %11
%25 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
br label %34
26: ; preds = %11
%27 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
br label %34
28: ; preds = %11
%29 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
br label %34
30: ; preds = %11
%31 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
br label %34
32: ; preds = %11
%33 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0))
br label %34
34: ; preds = %9, %14, %18, %22, %26, %30, %32, %28, %24, %20, %16, %12, %4
%35 = phi i32 [ 0, %4 ], [ 0, %9 ], [ 0, %12 ], [ 0, %14 ], [ 0, %16 ], [ 0, %18 ], [ 0, %20 ], [ 0, %22 ], [ 0, %24 ], [ 0, %26 ], [ 0, %28 ], [ 0, %30 ], [ -1, %32 ]
ret i32 %35
}