#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 *get_string_type(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strlen(char *);
char *vcalloc(int, int);
int /*<<< orphan*/ vfree(char *);
char *get_array_type(int n, char **seq) {
  char *buf, *buf2;
  int a, tot = 0;
  buf2 = vcalloc(100, sizeof(char));
  for (tot = 0, a = 0; a < n; a++) {
    tot += strlen(seq[a]);
  }
  buf = vcalloc(tot + 1, sizeof(char));
  for (a = 0; a < n; a++) {
    strcat(buf, seq[a]);
  }
  sprintf(buf2, "%s", get_string_type(buf));
  vfree(buf);
  return buf2;
}


x86 assembly (clang, -O0):
<get_array_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x28(%rbp)
mov    $0x64,%edi
mov    $0x1,%esi
call   1080 <vcalloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11cf <get_array_type+0x6f>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
movslq -0x28(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1197 <get_array_type+0x37>
mov    -0x28(%rbp),%edi
add    $0x1,%edi
mov    $0x1,%esi
call   1080 <vcalloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1219 <get_array_type+0xb9>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1060 <strcat@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11ea <get_array_type+0x8a>
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <get_string_type@plt>
mov    -0x30(%rbp),%rdi
mov    %rax,%rdx
lea    0xdc8(%rip),%rsi
call   1070 <sprintf@plt>
mov    -0x18(%rbp),%rdi
call   1050 <vfree@plt>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_array_type>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r12
mov    %edi,%r15d
mov    $0x64,%edi
mov    $0x1,%esi
call   1080 <vcalloc@plt>
mov    %rax,%r14
test   %r15d,%r15d
jle    11d7 <get_array_type+0x77>
mov    %r15d,%r13d
xor    %ebx,%ebx
xor    %ebp,%ebp
nop
mov    (%r12,%rbx,8),%rdi
call   1040 <strlen@plt>
add    %eax,%ebp
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1190 <get_array_type+0x30>
add    $0x1,%ebp
mov    %ebp,%edi
mov    $0x1,%esi
call   1080 <vcalloc@plt>
mov    %rax,%rbp
test   %r15d,%r15d
jle    11e9 <get_array_type+0x89>
xor    %ebx,%ebx
nopl   (%rax)
mov    (%r12,%rbx,8),%rsi
mov    %rbp,%rdi
call   1070 <strcat@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    11c0 <get_array_type+0x60>
jmp    11e9 <get_array_type+0x89>
mov    $0x1,%edi
mov    $0x1,%esi
call   1080 <vcalloc@plt>
mov    %rax,%rbp
mov    %rbp,%rdi
call   1050 <get_string_type@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
mov    %rbp,%rdi
call   1060 <vfree@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i8* @get_array_type(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 0, i32* %8
%9 = call i8* @vcalloc(i32 100, i32 1)
store i8* %9, i8** %6
store i32 0, i32* %8
store i32 0, i32* %7
br label %10
10: ; preds = %25, %2
%11 = load i32, i32* %7
%12 = load i32, i32* %3
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %28
14: ; preds = %10
%15 = load i8**, i8*** %4
%16 = load i32, i32* %7
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
%19 = load i8*, i8** %18
%20 = call i64 @strlen(i8* %19)
%21 = load i32, i32* %8
%22 = sext i32 %21 to i64
%23 = add nsw i64 %22, %20
%24 = trunc i64 %23 to i32
store i32 %24, i32* %8
br label %25
25: ; preds = %14
%26 = load i32, i32* %7
%27 = add nsw i32 %26, 1
store i32 %27, i32* %7
br label %10
28: ; preds = %10
%29 = load i32, i32* %8
%30 = add nsw i32 %29, 1
%31 = call i8* @vcalloc(i32 %30, i32 1)
store i8* %31, i8** %5
store i32 0, i32* %7
br label %32
32: ; preds = %44, %28
%33 = load i32, i32* %7
%34 = load i32, i32* %3
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %47
36: ; preds = %32
%37 = load i8*, i8** %5
%38 = load i8**, i8*** %4
%39 = load i32, i32* %7
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8*, i8** %38, i64 %40
%42 = load i8*, i8** %41
%43 = call i32 @strcat(i8* %37, i8* %42)
br label %44
44: ; preds = %36
%45 = load i32, i32* %7
%46 = add nsw i32 %45, 1
store i32 %46, i32* %7
br label %32
47: ; preds = %32
%48 = load i8*, i8** %6
%49 = load i8*, i8** %5
%50 = call i8* @get_string_type(i8* %49)
%51 = call i32 @sprintf(i8* %48, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %50)
%52 = load i8*, i8** %5
%53 = call i32 @vfree(i8* %52)
%54 = load i8*, i8** %6
ret i8* %54
}

LLVM IR (-O2):
define i8* @get_array_type(i32 %0, i8** nocapture %1) {
%3 = tail call i8* @vcalloc(i32 100, i32 1)
%4 = icmp sgt i32 %0, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i8* @vcalloc(i32 1, i32 1)
br label %31
7: ; preds = %2
%8 = zext i32 %0 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %17, %9 ]
%11 = phi i32 [ 0, %7 ], [ %16, %9 ]
%12 = getelementptr inbounds i8*, i8** %1, i64 %10
%13 = load i8*, i8** %12
%14 = tail call i64 @strlen(i8* dereferenceable(1) %13)
%15 = trunc i64 %14 to i32
%16 = add i32 %11, %15
%17 = add nuw nsw i64 %10, 1
%18 = icmp eq i64 %17, %8
br i1 %18, label %19, label %9
19: ; preds = %9
%20 = add i32 %16, 1
%21 = tail call i8* @vcalloc(i32 %20, i32 1)
br i1 %4, label %22, label %31
22: ; preds = %19
%23 = zext i32 %0 to i64
br label %24
24: ; preds = %22, %24
%25 = phi i64 [ 0, %22 ], [ %29, %24 ]
%26 = getelementptr inbounds i8*, i8** %1, i64 %25
%27 = load i8*, i8** %26
%28 = tail call i32 @strcat(i8* %21, i8* %27)
%29 = add nuw nsw i64 %25, 1
%30 = icmp eq i64 %29, %23
br i1 %30, label %31, label %24
31: ; preds = %24, %5, %19
%32 = phi i8* [ %6, %5 ], [ %21, %19 ], [ %21, %24 ]
%33 = tail call i8* @get_string_type(i8* %32)
%34 = tail call i8* @strcpy(i8* dereferenceable(1) %3, i8* dereferenceable(1) %33)
%35 = tail call i32 @vfree(i8* %32)
ret i8* %3
}