#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*/ nocc_pinternal(char *, char *, int, unsigned int);
int /*<<< orphan*/ sprintf(char *, char *, ...);
char *krocllvm_typestr(const int type) {
  static char buf[16];
  static int boffs = 0;
  int thisoff;
  if (type == 0x00000000) {
    sprintf(&buf[boffs], "void");
  } else if (type & 0x00001000) {
    sprintf(&buf[boffs], "i%d", type & 0xfff);
  } else if (type & 0x00002000) {
    if ((type & 0xfff) == 32) {
      sprintf(&buf[boffs], "float");
    } else if ((type & 0xfff) == 64) {
      sprintf(&buf[boffs], "double");
    } else if ((type & 0xfff) == 128) {
      sprintf(&buf[boffs], "fp128");
    } else {
      nocc_pinternal(("krocllvm_typestr(): invalid FP type 0x%8.8x\n"),
                     "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                     "outputs/2022-01-22/02-19-57/repos/concurrency/nocc/refs/"
                     "heads/master/backend/krocllvm.c",
                     450, (unsigned int)type);
    }
  } else {
    nocc_pinternal(("krocllvm_typestr(): invalid type 0x%8.8x\n"),
                   "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                   "outputs/2022-01-22/02-19-57/repos/concurrency/nocc/refs/"
                   "heads/master/backend/krocllvm.c",
                   453, (unsigned int)type);
  }
  thisoff = boffs;
  boffs = 8 - boffs;
  return &buf[thisoff];
}


x86 assembly (clang, -O0):
<krocllvm_typestr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1159 <krocllvm_typestr+0x39>
movslq 0x2f14(%rip),%rax
lea    0x2efd(%rip),%rdi
add    %rax,%rdi
lea    0xeb3(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    1298 <krocllvm_typestr+0x178>
mov    -0x4(%rbp),%eax
and    $0x1000,%eax
cmp    $0x0,%eax
je     1197 <krocllvm_typestr+0x77>
movslq 0x2edf(%rip),%rax
lea    0x2ec8(%rip),%rdi
add    %rax,%rdi
mov    -0x4(%rbp),%edx
and    $0xfff,%edx
lea    0xe7a(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    1293 <krocllvm_typestr+0x173>
mov    -0x4(%rbp),%eax
and    $0x2000,%eax
cmp    $0x0,%eax
je     1273 <krocllvm_typestr+0x153>
mov    -0x4(%rbp),%eax
and    $0xfff,%eax
cmp    $0x20,%eax
jne    11dd <krocllvm_typestr+0xbd>
movslq 0x2e90(%rip),%rax
lea    0x2e79(%rip),%rdi
add    %rax,%rdi
lea    0xe38(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    126e <krocllvm_typestr+0x14e>
mov    -0x4(%rbp),%eax
and    $0xfff,%eax
cmp    $0x40,%eax
jne    1212 <krocllvm_typestr+0xf2>
movslq 0x2e5b(%rip),%rax
lea    0x2e44(%rip),%rdi
add    %rax,%rdi
lea    0xe09(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    1269 <krocllvm_typestr+0x149>
mov    -0x4(%rbp),%eax
and    $0xfff,%eax
cmp    $0x80,%eax
jne    1249 <krocllvm_typestr+0x129>
movslq 0x2e24(%rip),%rax
lea    0x2e0d(%rip),%rdi
add    %rax,%rdi
lea    0xdd9(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    1264 <krocllvm_typestr+0x144>
mov    -0x4(%rbp),%ecx
lea    0xdc9(%rip),%rdi
lea    0xdef(%rip),%rsi
mov    $0x1c2,%edx
call   1040 <nocc_pinternal@plt>
jmp    1269 <krocllvm_typestr+0x149>
jmp    126e <krocllvm_typestr+0x14e>
jmp    128e <krocllvm_typestr+0x16e>
mov    -0x4(%rbp),%ecx
lea    0xe5c(%rip),%rdi
lea    0xdc5(%rip),%rsi
mov    $0x1c5,%edx
call   1040 <nocc_pinternal@plt>
jmp    1293 <krocllvm_typestr+0x173>
jmp    1298 <krocllvm_typestr+0x178>
mov    0x2db2(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    $0x8,%eax
sub    0x2da4(%rip),%eax
mov    %eax,0x2d9e(%rip)
movslq -0x8(%rbp),%rcx
lea    0x2d83(%rip),%rax
add    %rcx,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<krocllvm_typestr>:
push   %rax
test   %edi,%edi
je     114f <krocllvm_typestr+0x2f>
mov    %edi,%ecx
test   $0x1000,%edi
jne    116d <krocllvm_typestr+0x4d>
test   $0x2000,%ecx
jne    1198 <krocllvm_typestr+0x78>
lea    0xf9b(%rip),%rdi
lea    0xf04(%rip),%rsi
mov    $0x1c5,%edx
jmp    121b <krocllvm_typestr+0xfb>
mov    0x2efb(%rip),%eax
lea    0x2ee4(%rip),%rcx
movl   $0x64696f76,(%rax,%rcx,1)
movb   $0x0,0x4(%rax,%rcx,1)
jmp    1220 <krocllvm_typestr+0x100>
mov    0x2edd(%rip),%eax
lea    0x2ec6(%rip),%rdi
add    %rax,%rdi
and    $0xfff,%ecx
lea    0xe7b(%rip),%rsi
mov    %ecx,%edx
xor    %eax,%eax
call   1030 <sprintf@plt>
jmp    1220 <krocllvm_typestr+0x100>
mov    %ecx,%eax
and    $0xfff,%eax
cmp    $0x80,%eax
je     11cd <krocllvm_typestr+0xad>
cmp    $0x40,%eax
je     11ea <krocllvm_typestr+0xca>
cmp    $0x20,%eax
jne    1208 <krocllvm_typestr+0xe8>
mov    0x2e9a(%rip),%eax
lea    0x2e83(%rip),%rcx
movl   $0x616f6c66,(%rax,%rcx,1)
movw   $0x74,0x4(%rax,%rcx,1)
jmp    1220 <krocllvm_typestr+0x100>
mov    0x2e7d(%rip),%eax
lea    0x2e66(%rip),%rcx
movl   $0x32317066,(%rax,%rcx,1)
movw   $0x38,0x4(%rax,%rcx,1)
jmp    1220 <krocllvm_typestr+0x100>
mov    0x2e60(%rip),%eax
lea    0x2e49(%rip),%rcx
movl   $0x62756f64,(%rax,%rcx,1)
movl   $0x656c62,0x3(%rax,%rcx,1)
jmp    1220 <krocllvm_typestr+0x100>
lea    0xe0d(%rip),%rdi
lea    0xe33(%rip),%rsi
mov    $0x1c2,%edx
call   1040 <nocc_pinternal@plt>
mov    0x2e2a(%rip),%ecx
mov    $0x8,%eax
sub    %ecx,%eax
mov    %eax,0x2e1d(%rip)
lea    0x2e06(%rip),%rax
add    %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
@krocllvm_typestr.buf = internal global [16 x i8] zeroinitializer
@krocllvm_typestr.boffs = internal global i32 0
@.str = [5 x i8] c"void\00"
@.str.1 = [4 x i8] c"i%d\00"
@.str.2 = [6 x i8] c"float\00"
@.str.3 = [7 x i8] c"double\00"
@.str.4 = [6 x i8] c"fp128\00"
@.str.5 = [45 x i8] c"krocllvm_typestr(): invalid FP type 0x%8.8x\0A\00"
@.str.6 = [144 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/concurrency/nocc/refs/heads/master/backend/krocllvm.c\00"
@.str.7 = [42 x i8] c"krocllvm_typestr(): invalid type 0x%8.8x\0A\00"
define i8* @krocllvm_typestr(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i32, i32* @krocllvm_typestr.boffs
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [16 x i8], [16 x i8]* @krocllvm_typestr.buf, i64 0, i64 %8
%10 = call i32 (i8*, i8*, ...) @sprintf(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %64
11: ; preds = %1
%12 = load i32, i32* %2
%13 = and i32 %12, 4096
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %22
15: ; preds = %11
%16 = load i32, i32* @krocllvm_typestr.boffs
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [16 x i8], [16 x i8]* @krocllvm_typestr.buf, i64 0, i64 %17
%19 = load i32, i32* %2
%20 = and i32 %19, 4095
%21 = call i32 (i8*, i8*, ...) @sprintf(i8* %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %20)
br label %63
22: ; preds = %11
%23 = load i32, i32* %2
%24 = and i32 %23, 8192
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %59
26: ; preds = %22
%27 = load i32, i32* %2
%28 = and i32 %27, 4095
%29 = icmp eq i32 %28, 32
br i1 %29, label %30, label %35
30: ; preds = %26
%31 = load i32, i32* @krocllvm_typestr.boffs
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [16 x i8], [16 x i8]* @krocllvm_typestr.buf, i64 0, i64 %32
%34 = call i32 (i8*, i8*, ...) @sprintf(i8* %33, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %58
35: ; preds = %26
%36 = load i32, i32* %2
%37 = and i32 %36, 4095
%38 = icmp eq i32 %37, 64
br i1 %38, label %39, label %44
39: ; preds = %35
%40 = load i32, i32* @krocllvm_typestr.boffs
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [16 x i8], [16 x i8]* @krocllvm_typestr.buf, i64 0, i64 %41
%43 = call i32 (i8*, i8*, ...) @sprintf(i8* %42, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %57
44: ; preds = %35
%45 = load i32, i32* %2
%46 = and i32 %45, 4095
%47 = icmp eq i32 %46, 128
br i1 %47, label %48, label %53
48: ; preds = %44
%49 = load i32, i32* @krocllvm_typestr.boffs
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [16 x i8], [16 x i8]* @krocllvm_typestr.buf, i64 0, i64 %50
%52 = call i32 (i8*, i8*, ...) @sprintf(i8* %51, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %56
53: ; preds = %44
%54 = load i32, i32* %2
%55 = call i32 @nocc_pinternal(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str.6, i64 0, i64 0), i32 450, i32 %54)
br label %56
56: ; preds = %53, %48
br label %57
57: ; preds = %56, %39
br label %58
58: ; preds = %57, %30
br label %62
59: ; preds = %22
%60 = load i32, i32* %2
%61 = call i32 @nocc_pinternal(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str.6, i64 0, i64 0), i32 453, i32 %60)
br label %62
62: ; preds = %59, %58
br label %63
63: ; preds = %62, %15
br label %64
64: ; preds = %63, %6
%65 = load i32, i32* @krocllvm_typestr.boffs
store i32 %65, i32* %3
%66 = load i32, i32* @krocllvm_typestr.boffs
%67 = sub nsw i32 8, %66
store i32 %67, i32* @krocllvm_typestr.boffs
%68 = load i32, i32* %3
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [16 x i8], [16 x i8]* @krocllvm_typestr.buf, i64 0, i64 %69
ret i8* %70
}

LLVM IR (-O2):
@krocllvm_typestr.buf = internal global [16 x i8] zeroinitializer
@krocllvm_typestr.boffs = internal unnamed_addr global i32 0
@.str = [5 x i8] c"void\00"
@.str.1 = [4 x i8] c"i%d\00"
@.str.2 = [6 x i8] c"float\00"
@.str.3 = [7 x i8] c"double\00"
@.str.4 = [6 x i8] c"fp128\00"
@.str.5 = [45 x i8] c"krocllvm_typestr(): invalid FP type 0x%8.8x\0A\00"
@.str.6 = [144 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/concurrency/nocc/refs/heads/master/backend/krocllvm.c\00"
@.str.7 = [42 x i8] c"krocllvm_typestr(): invalid type 0x%8.8x\0A\00"
define i8* @krocllvm_typestr(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = load i32, i32* @krocllvm_typestr.boffs
%5 = zext i32 %4 to i64
%6 = getelementptr inbounds [16 x i8], [16 x i8]* @krocllvm_typestr.buf, i64 0, i64 %5
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(5) %6, i8* align 1 dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 5, i1 false)
br label %37
7: ; preds = %1
%8 = and i32 %0, 4096
%9 = icmp eq i32 %8, 0
br i1 %9, label %16, label %10
10: ; preds = %7
%11 = load i32, i32* @krocllvm_typestr.boffs
%12 = zext i32 %11 to i64
%13 = getelementptr inbounds [16 x i8], [16 x i8]* @krocllvm_typestr.buf, i64 0, i64 %12
%14 = and i32 %0, 4095
%15 = tail call i32 (i8*, i8*, ...) @sprintf(i8* %13, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %14)
br label %37
16: ; preds = %7
%17 = and i32 %0, 8192
%18 = icmp eq i32 %17, 0
br i1 %18, label %35, label %19
19: ; preds = %16
%20 = and i32 %0, 4095
switch i32 %20, label %33 [
i32 32, label %21
i32 64, label %25
i32 128, label %29
]
21: ; preds = %19
%22 = load i32, i32* @krocllvm_typestr.boffs
%23 = zext i32 %22 to i64
%24 = getelementptr inbounds [16 x i8], [16 x i8]* @krocllvm_typestr.buf, i64 0, i64 %23
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(6) %24, i8* align 1 dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 6, i1 false)
br label %37
25: ; preds = %19
%26 = load i32, i32* @krocllvm_typestr.boffs
%27 = zext i32 %26 to i64
%28 = getelementptr inbounds [16 x i8], [16 x i8]* @krocllvm_typestr.buf, i64 0, i64 %27
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(7) %28, i8* align 1 dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i64 7, i1 false)
br label %37
29: ; preds = %19
%30 = load i32, i32* @krocllvm_typestr.boffs
%31 = zext i32 %30 to i64
%32 = getelementptr inbounds [16 x i8], [16 x i8]* @krocllvm_typestr.buf, i64 0, i64 %31
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(6) %32, i8* align 1 dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i64 6, i1 false)
br label %37
33: ; preds = %19
%34 = tail call i32 @nocc_pinternal(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str.6, i64 0, i64 0), i32 450, i32 %0)
br label %37
35: ; preds = %16
%36 = tail call i32 @nocc_pinternal(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str.6, i64 0, i64 0), i32 453, i32 %0)
br label %37
37: ; preds = %10, %21, %29, %33, %25, %35, %3
%38 = load i32, i32* @krocllvm_typestr.boffs
%39 = sub nsw i32 8, %38
store i32 %39, i32* @krocllvm_typestr.boffs
%40 = zext i32 %38 to i64
%41 = getelementptr inbounds [16 x i8], [16 x i8]* @krocllvm_typestr.buf, i64 0, i64 %40
ret i8* %41
}