#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*/ exit(int);
char *getSubstring(char const *, int, scalar_t__);
int /*<<< orphan*/ parameterIsArray(char const *);
int /*<<< orphan*/ puts(char *);
scalar_t__ strlen(char const *);
char *getArrayType(const char *parameterType) {
  if (!parameterIsArray(parameterType)) {
    puts("Parameter type is no array!");
    exit(1);
  }
  const char *arrayDeclaration = " []";
  return getSubstring(parameterType, 1,
                      strlen(parameterType) - strlen(arrayDeclaration));
}


x86 assembly (clang, -O0):
<getArrayType>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <parameterIsArray@plt>
cmp    $0x0,%eax
jne    1184 <getArrayType+0x34>
lea    0xe8b(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
lea    0xe91(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rdi
sub    %rax,%rdx
mov    $0x1,%esi
call   1070 <getSubstring@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getArrayType>:
push   %rbx
mov    %rdi,%rbx
call   1050 <parameterIsArray@plt>
test   %eax,%eax
je     1177 <getArrayType+0x27>
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    -0x3(%rax),%rdx
mov    %rbx,%rdi
mov    $0x1,%esi
pop    %rbx
jmp    1070 <getSubstring@plt>
lea    0xe82(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"Parameter type is no array!\00"
@.str.1 = [4 x i8] c" []\00"
define i8* @getArrayType(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @parameterIsArray(i8* %4)
%6 = icmp ne i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %1
%8 = call i32 @puts(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @exit(i32 1)
unreachable
10: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %3
%11 = load i8*, i8** %2
%12 = load i8*, i8** %2
%13 = call i64 @strlen(i8* %12)
%14 = load i8*, i8** %3
%15 = call i64 @strlen(i8* %14)
%16 = sub nsw i64 %13, %15
%17 = call i8* @getSubstring(i8* %11, i32 1, i64 %16)
ret i8* %17
}

LLVM IR (-O2):
@.str = [28 x i8] c"Parameter type is no array!\00"
define i8* @getArrayType(i8* %0) {
%2 = tail call i32 @parameterIsArray(i8* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %1
%8 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%9 = add nsw i64 %8, -3
%10 = tail call i8* @getSubstring(i8* %0, i32 1, i64 %9)
ret i8* %10
}