#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_mkKVarName(char *);
char *UTIL_mallocStr(size_t);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *genTySkelApp(char *sortName, char *args) {
  char *ctr = OC_mkDotStr("Absyn", "ApplicationType");
  char *sortVar = OC_mkKVarName(sortName);
  size_t length = strlen(ctr) + strlen(sortVar) + strlen(args) + 5;
  char *apptype = UTIL_mallocStr(length + 1);
  strcpy(apptype, ctr);
  free(ctr);
  strcat(apptype, "(");
  strcat(apptype, sortVar);
  free(sortVar);
  strcat(apptype, ", ");
  strcat(apptype, args);
  strcat(apptype, ")");
  return apptype;
}


x86 assembly (clang, -O0):
<genTySkelApp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe79(%rip),%rdi
lea    0xe78(%rip),%rsi
call   1090 <OC_mkDotStr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1080 <OC_mkKVarName@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
add    %ecx,%eax
add    $0x5,%eax
cltq
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
add    $0x1,%rdi
call   1060 <UTIL_mallocStr@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
lea    0xe08(%rip),%rsi
call   1070 <strcat@plt>
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1070 <strcat@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
lea    0xde4(%rip),%rsi
call   1070 <strcat@plt>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1070 <strcat@plt>
mov    -0x30(%rbp),%rdi
lea    0xdca(%rip),%rsi
call   1070 <strcat@plt>
mov    -0x30(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<genTySkelApp>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xe7b(%rip),%rdi
lea    0xe7a(%rip),%rsi
call   1090 <OC_mkDotStr@plt>
mov    %rax,%r12
mov    %rbx,%rdi
call   1080 <OC_mkKVarName@plt>
mov    %rax,%r15
mov    %r12,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebx
mov    %r15,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
add    %ebx,%ebp
mov    %r14,%rdi
call   1050 <strlen@plt>
add    %ebp,%eax
movslq %eax,%rdi
add    $0x6,%rdi
call   1060 <UTIL_mallocStr@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r12,%rsi
call   1040 <strcpy@plt>
mov    %r12,%rdi
call   1030 <free@plt>
lea    0xe2e(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcat@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <strcat@plt>
mov    %r15,%rdi
call   1030 <free@plt>
lea    0xe0e(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <strcat@plt>
lea    0xdf7(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcat@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"Absyn\00"
@.str.1 = [16 x i8] c"ApplicationType\00"
@.str.2 = [2 x i8] c"(\00"
@.str.3 = [3 x i8] c", \00"
@.str.4 = [2 x i8] c")\00"
define i8* @genTySkelApp(i8* %0, i8* %1) {
%3 = tail call i8* @OC_mkDotStr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i8* @OC_mkKVarName(i8* %0)
%5 = tail call i32 @strlen(i8* %3)
%6 = tail call i32 @strlen(i8* %4)
%7 = add nsw i32 %6, %5
%8 = tail call i32 @strlen(i8* %1)
%9 = add nsw i32 %7, %8
%10 = sext i32 %9 to i64
%11 = add nsw i64 %10, 6
%12 = tail call i8* @UTIL_mallocStr(i64 %11)
%13 = tail call i32 @strcpy(i8* %12, i8* %3)
%14 = tail call i32 @free(i8* %3)
%15 = tail call i32 @strcat(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%16 = tail call i32 @strcat(i8* %12, i8* %4)
%17 = tail call i32 @free(i8* %4)
%18 = tail call i32 @strcat(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%19 = tail call i32 @strcat(i8* %12, i8* %1)
%20 = tail call i32 @strcat(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret i8* %12
}