#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*/ SA_IS(unsigned char *, int *, int, int, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  unsigned char *s =
      "CCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTA$";
  int n = 71;
  int i;
  int *SA = (int *)malloc(sizeof(int) * n);
  SA_IS(s, SA, n, 256, sizeof(char));
  printf("done\n");
  for (i = 0; i < n; ++i) {
    printf("%d ", SA[i]);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x47,-0x14(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    $0x100,%ecx
mov    $0x1,%r8d
call   1050 <SA_IS@plt>
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11c7 <main+0x97>
mov    -0x20(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1194 <main+0x64>
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x11c,%edi
call   1060 <malloc@plt>
mov    %rax,%r15
lea    0xe97(%rip),%rdi
mov    %rax,%rsi
mov    $0x47,%edx
mov    $0x100,%ecx
mov    $0x1,%r8d
call   1070 <SA_IS@plt>
lea    0xec4(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb4(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    $0x47,%rbx
jne    11a0 <main+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [72 x i8] c"CCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTA$\00"
@.str.1 = [6 x i8] c"done\0A\00"
@.str.2 = [4 x i8] c"%d \00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
store i32 0, i32* %1
store i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0), i8** %2
store i32 71, i32* %3
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = mul i64 4, %7
%9 = trunc i64 %8 to i32
%10 = call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to i32*
store i32* %11, i32** %5
%12 = load i8*, i8** %2
%13 = load i32*, i32** %5
%14 = load i32, i32* %3
%15 = call i32 @SA_IS(i8* %12, i32* %13, i32 %14, i32 256, i32 1)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %4
br label %17
17: ; preds = %28, %0
%18 = load i32, i32* %4
%19 = load i32, i32* %3
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %31
21: ; preds = %17
%22 = load i32*, i32** %5
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32, i32* %22, i64 %24
%26 = load i32, i32* %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %21
%29 = load i32, i32* %4
%30 = add nsw i32 %29, 1
store i32 %30, i32* %4
br label %17
31: ; preds = %17
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [72 x i8] c"CCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTA$\00"
@.str.2 = [4 x i8] c"%d \00"
@str = [5 x i8] c"done\00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 284)
%2 = inttoptr i64 %1 to i32*
%3 = tail call i32 @SA_IS(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0), i32* %2, i32 71, i32 256, i32 1)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
br label %5
5: ; preds = %0, %5
%6 = phi i64 [ 0, %0 ], [ %10, %5 ]
%7 = getelementptr inbounds i32, i32* %2, i64 %6
%8 = load i32, i32* %7
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %8)
%10 = add nuw nsw i64 %6, 1
%11 = icmp eq i64 %10, 71
br i1 %11, label %12, label %5
12: ; preds = %5
%13 = tail call i32 @putchar(i32 10)
ret i32 0
}