#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 */
char *OC_mkDotStr(char *, char *);
char *OC_mkRef(char *);
char *OC_mkSome(char *);
char *OC_mkSymbol(char *);
char *OC_mkVarDef(char *, char *);
char *UTIL_mallocStr(size_t);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *OC_mkKindVar(char *varName, char *kindName, char *arity, char *offset) {
  char *kindvar;
  char *ctr = OC_mkDotStr("Absyn", "Kind");
  char *symbol = OC_mkSymbol(kindName);
  char *nargs = OC_mkSome(arity);
  char *index = OC_mkRef(offset);
  char *ktype = OC_mkDotStr("Absyn", "PervasiveKind");
  char *pos = OC_mkDotStr("Errormsg", "none");
  size_t length = strlen(ctr) + strlen(symbol) + strlen(nargs) + strlen(index) +
                  strlen(ktype) + strlen(pos) + 10;
  char *def = UTIL_mallocStr(length + 1);
  strcpy(def, ctr);
  free(ctr);
  strcat(def, "(");
  strcat(def, symbol);
  free(symbol);
  strcat(def, ", ");
  strcat(def, nargs);
  free(nargs);
  strcat(def, ", ");
  strcat(def, index);
  free(index);
  strcat(def, ", ");
  strcat(def, ktype);
  free(ktype);
  strcat(def, ", ");
  strcat(def, pos);
  free(pos);
  strcat(def, ")");
  kindvar = OC_mkVarDef(varName, def);
  free(def);
  return kindvar;
}


x86 assembly (clang, -O0):
<OC_mkKindVar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    0xe3e(%rip),%rdi
lea    0xe46(%rip),%rsi
call   10c0 <OC_mkDotStr@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
call   10b0 <OC_mkSymbol@plt>
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <OC_mkSome@plt>
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%rdi
call   1070 <OC_mkRef@plt>
mov    %rax,-0x48(%rbp)
lea    0xe00(%rip),%rdi
lea    0xdff(%rip),%rsi
call   10c0 <OC_mkDotStr@plt>
mov    %rax,-0x50(%rbp)
lea    0xdfd(%rip),%rdi
lea    0xdff(%rip),%rsi
call   10c0 <OC_mkDotStr@plt>
mov    %rax,-0x58(%rbp)
mov    -0x30(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x7c(%rbp)
mov    -0x38(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x7c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x78(%rbp)
mov    -0x40(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x78(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x74(%rbp)
mov    -0x48(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x74(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x70(%rbp)
mov    -0x50(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x70(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x6c(%rbp)
mov    -0x58(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x6c(%rbp),%eax
add    %ecx,%eax
add    $0xa,%eax
cltq
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rdi
add    $0x1,%rdi
call   1090 <UTIL_mallocStr@plt>
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x68(%rbp),%rdi
lea    0xd58(%rip),%rsi
call   10a0 <strcat@plt>
mov    -0x68(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   10a0 <strcat@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x68(%rbp),%rdi
lea    0xd34(%rip),%rsi
call   10a0 <strcat@plt>
mov    -0x68(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   10a0 <strcat@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x68(%rbp),%rdi
lea    0xd0e(%rip),%rsi
call   10a0 <strcat@plt>
mov    -0x68(%rbp),%rdi
mov    -0x48(%rbp),%rsi
call   10a0 <strcat@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x68(%rbp),%rdi
lea    0xce8(%rip),%rsi
call   10a0 <strcat@plt>
mov    -0x68(%rbp),%rdi
mov    -0x50(%rbp),%rsi
call   10a0 <strcat@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
mov    -0x68(%rbp),%rdi
lea    0xcc2(%rip),%rsi
call   10a0 <strcat@plt>
mov    -0x68(%rbp),%rdi
mov    -0x58(%rbp),%rsi
call   10a0 <strcat@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
mov    -0x68(%rbp),%rdi
lea    0xc9f(%rip),%rsi
call   10a0 <strcat@plt>
mov    -0x8(%rbp),%rdi
mov    -0x68(%rbp),%rsi
call   1080 <OC_mkVarDef@plt>
mov    %rax,-0x28(%rbp)
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OC_mkKindVar>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,0x20(%rsp)
lea    0xe3d(%rip),%r12
lea    0xe45(%rip),%rsi
mov    %r12,%rdi
call   10c0 <OC_mkDotStr@plt>
mov    %rax,%rbp
mov    %rax,0x8(%rsp)
mov    %rbx,%rdi
call   10b0 <OC_mkSymbol@plt>
mov    %rax,%rbx
mov    %rax,0x10(%rsp)
mov    %r15,%rdi
call   1060 <OC_mkSome@plt>
mov    %rax,%r15
mov    %rax,0x18(%rsp)
mov    %r14,%rdi
call   1070 <OC_mkRef@plt>
mov    %rax,%r13
lea    0xdfa(%rip),%rsi
mov    %r12,%rdi
call   10c0 <OC_mkDotStr@plt>
mov    %rax,%r12
lea    0xdf6(%rip),%rdi
lea    0xdf8(%rip),%rsi
call   10c0 <OC_mkDotStr@plt>
mov    %rax,%r14
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebx
add    %ebp,%ebx
mov    %r15,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
add    %ebx,%ebp
mov    %r13,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebx
add    %ebp,%ebx
mov    %r12,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
add    %ebx,%ebp
mov    %r14,%rdi
mov    %r14,%rbx
call   1050 <strlen@plt>
add    %ebp,%eax
movslq %eax,%rdi
add    $0xb,%rdi
call   1090 <UTIL_mallocStr@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    0x8(%rsp),%rbp
mov    %rbp,%rsi
call   1040 <strcpy@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
lea    0xd80(%rip),%rsi
mov    %r14,%rdi
call   10a0 <strcat@plt>
mov    %r14,%rdi
mov    0x10(%rsp),%rbp
mov    %rbp,%rsi
call   10a0 <strcat@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
lea    0xd5b(%rip),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   10a0 <strcat@plt>
mov    %r14,%rdi
mov    0x18(%rsp),%rbp
mov    %rbp,%rsi
call   10a0 <strcat@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   10a0 <strcat@plt>
mov    %r14,%rdi
mov    %r13,%rsi
call   10a0 <strcat@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   10a0 <strcat@plt>
mov    %r14,%rdi
mov    %r12,%rsi
call   10a0 <strcat@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   10a0 <strcat@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   10a0 <strcat@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0xcda(%rip),%rsi
mov    %r14,%rdi
call   10a0 <strcat@plt>
mov    0x20(%rsp),%rdi
mov    %r14,%rsi
call   1080 <OC_mkVarDef@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"Absyn\00"
@.str.1 = [5 x i8] c"Kind\00"
@.str.2 = [14 x i8] c"PervasiveKind\00"
@.str.3 = [9 x i8] c"Errormsg\00"
@.str.4 = [5 x i8] c"none\00"
@.str.5 = [2 x i8] c"(\00"
@.str.6 = [3 x i8] c", \00"
@.str.7 = [2 x i8] c")\00"
define i8* @OC_mkKindVar(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i64
%17 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%18 = call i8* @OC_mkDotStr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
store i8* %18, i8** %10
%19 = load i8*, i8** %6
%20 = call i8* @OC_mkSymbol(i8* %19)
store i8* %20, i8** %11
%21 = load i8*, i8** %7
%22 = call i8* @OC_mkSome(i8* %21)
store i8* %22, i8** %12
%23 = load i8*, i8** %8
%24 = call i8* @OC_mkRef(i8* %23)
store i8* %24, i8** %13
%25 = call i8* @OC_mkDotStr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
store i8* %25, i8** %14
%26 = call i8* @OC_mkDotStr(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
store i8* %26, i8** %15
%27 = load i8*, i8** %10
%28 = call i32 @strlen(i8* %27)
%29 = load i8*, i8** %11
%30 = call i32 @strlen(i8* %29)
%31 = add nsw i32 %28, %30
%32 = load i8*, i8** %12
%33 = call i32 @strlen(i8* %32)
%34 = add nsw i32 %31, %33
%35 = load i8*, i8** %13
%36 = call i32 @strlen(i8* %35)
%37 = add nsw i32 %34, %36
%38 = load i8*, i8** %14
%39 = call i32 @strlen(i8* %38)
%40 = add nsw i32 %37, %39
%41 = load i8*, i8** %15
%42 = call i32 @strlen(i8* %41)
%43 = add nsw i32 %40, %42
%44 = add nsw i32 %43, 10
%45 = sext i32 %44 to i64
store i64 %45, i64* %16
%46 = load i64, i64* %16
%47 = add i64 %46, 1
%48 = call i8* @UTIL_mallocStr(i64 %47)
store i8* %48, i8** %17
%49 = load i8*, i8** %17
%50 = load i8*, i8** %10
%51 = call i32 @strcpy(i8* %49, i8* %50)
%52 = load i8*, i8** %10
%53 = call i32 @free(i8* %52)
%54 = load i8*, i8** %17
%55 = call i32 @strcat(i8* %54, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%56 = load i8*, i8** %17
%57 = load i8*, i8** %11
%58 = call i32 @strcat(i8* %56, i8* %57)
%59 = load i8*, i8** %11
%60 = call i32 @free(i8* %59)
%61 = load i8*, i8** %17
%62 = call i32 @strcat(i8* %61, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%63 = load i8*, i8** %17
%64 = load i8*, i8** %12
%65 = call i32 @strcat(i8* %63, i8* %64)
%66 = load i8*, i8** %12
%67 = call i32 @free(i8* %66)
%68 = load i8*, i8** %17
%69 = call i32 @strcat(i8* %68, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%70 = load i8*, i8** %17
%71 = load i8*, i8** %13
%72 = call i32 @strcat(i8* %70, i8* %71)
%73 = load i8*, i8** %13
%74 = call i32 @free(i8* %73)
%75 = load i8*, i8** %17
%76 = call i32 @strcat(i8* %75, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%77 = load i8*, i8** %17
%78 = load i8*, i8** %14
%79 = call i32 @strcat(i8* %77, i8* %78)
%80 = load i8*, i8** %14
%81 = call i32 @free(i8* %80)
%82 = load i8*, i8** %17
%83 = call i32 @strcat(i8* %82, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%84 = load i8*, i8** %17
%85 = load i8*, i8** %15
%86 = call i32 @strcat(i8* %84, i8* %85)
%87 = load i8*, i8** %15
%88 = call i32 @free(i8* %87)
%89 = load i8*, i8** %17
%90 = call i32 @strcat(i8* %89, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%91 = load i8*, i8** %5
%92 = load i8*, i8** %17
%93 = call i8* @OC_mkVarDef(i8* %91, i8* %92)
store i8* %93, i8** %9
%94 = load i8*, i8** %17
%95 = call i32 @free(i8* %94)
%96 = load i8*, i8** %9
ret i8* %96
}

LLVM IR (-O2):
@.str = [6 x i8] c"Absyn\00"
@.str.1 = [5 x i8] c"Kind\00"
@.str.2 = [14 x i8] c"PervasiveKind\00"
@.str.3 = [9 x i8] c"Errormsg\00"
@.str.4 = [5 x i8] c"none\00"
@.str.5 = [2 x i8] c"(\00"
@.str.6 = [3 x i8] c", \00"
@.str.7 = [2 x i8] c")\00"
define i8* @OC_mkKindVar(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = tail call i8* @OC_mkDotStr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i8* @OC_mkSymbol(i8* %1)
%7 = tail call i8* @OC_mkSome(i8* %2)
%8 = tail call i8* @OC_mkRef(i8* %3)
%9 = tail call i8* @OC_mkDotStr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%10 = tail call i8* @OC_mkDotStr(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%11 = tail call i32 @strlen(i8* %5)
%12 = tail call i32 @strlen(i8* %6)
%13 = add nsw i32 %12, %11
%14 = tail call i32 @strlen(i8* %7)
%15 = add nsw i32 %13, %14
%16 = tail call i32 @strlen(i8* %8)
%17 = add nsw i32 %15, %16
%18 = tail call i32 @strlen(i8* %9)
%19 = add nsw i32 %17, %18
%20 = tail call i32 @strlen(i8* %10)
%21 = add nsw i32 %19, %20
%22 = sext i32 %21 to i64
%23 = add nsw i64 %22, 11
%24 = tail call i8* @UTIL_mallocStr(i64 %23)
%25 = tail call i32 @strcpy(i8* %24, i8* %5)
%26 = tail call i32 @free(i8* %5)
%27 = tail call i32 @strcat(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%28 = tail call i32 @strcat(i8* %24, i8* %6)
%29 = tail call i32 @free(i8* %6)
%30 = tail call i32 @strcat(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%31 = tail call i32 @strcat(i8* %24, i8* %7)
%32 = tail call i32 @free(i8* %7)
%33 = tail call i32 @strcat(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%34 = tail call i32 @strcat(i8* %24, i8* %8)
%35 = tail call i32 @free(i8* %8)
%36 = tail call i32 @strcat(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%37 = tail call i32 @strcat(i8* %24, i8* %9)
%38 = tail call i32 @free(i8* %9)
%39 = tail call i32 @strcat(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%40 = tail call i32 @strcat(i8* %24, i8* %10)
%41 = tail call i32 @free(i8* %10)
%42 = tail call i32 @strcat(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%43 = tail call i8* @OC_mkVarDef(i8* %0, i8* %24)
%44 = tail call i32 @free(i8* %24)
ret i8* %43
}