#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*/ assert(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ showstack();
int /*<<< orphan*/ strcpy(char *, char const *);
int strlen(char *);
void process_array(char startstring[], int *sizelen) {
  char endstring[64];
  *sizelen = 0;
  int i = 0;
  assert(startstring);
  strcpy(endstring, (const char *)startstring);
  printf("array of ");
  while ((*sizelen < strlen(startstring)) && (endstring[*sizelen] != ']'))
    (*sizelen)++;
  if (endstring[*sizelen] == ']') {
    if (*sizelen >= 1) {
      while (i++ < *sizelen)
        printf("%c", startstring[i - 1]);
    }
    printf(" ");
    return;
  }
  showstack();
  printf("\nMismatched array delimiters.\n");
  exit(-1);
}


x86 assembly (clang, -O0):
<process_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x0,-0x54(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <assert@plt>
lea    -0x50(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x5c(%rbp),%ecx
mov    %eax,%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x55(%rbp)
jge    11de <process_array+0x7e>
mov    -0x10(%rbp),%rax
movslq (%rax),%rax
movsbl -0x50(%rbp,%rax,1),%eax
cmp    $0x5d,%eax
setne  %al
mov    %al,-0x55(%rbp)
mov    -0x55(%rbp),%al
test   $0x1,%al
jne    11ee <process_array+0x8e>
jmp    11fe <process_array+0x9e>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
jmp    11a5 <process_array+0x45>
mov    -0x10(%rbp),%rax
movslq (%rax),%rax
movsbl -0x50(%rbp,%rax,1),%eax
cmp    $0x5d,%eax
jne    1279 <process_array+0x119>
mov    -0x10(%rbp),%rax
cmpl   $0x1,(%rax)
jl     1265 <process_array+0x105>
jmp    1225 <process_array+0xc5>
mov    -0x54(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x54(%rbp)
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jge    1260 <process_array+0x100>
mov    -0x8(%rbp),%rax
mov    -0x54(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xdb6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1225 <process_array+0xc5>
jmp    1265 <process_array+0x105>
lea    0xd9c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
add    $0x60,%rsp
pop    %rbp
ret
mov    $0x0,%al
call   1080 <showstack@plt>
lea    0xd86(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<process_array>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %rsi,%r15
mov    %rdi,%r14
movl   $0x0,(%rsi)
call   1080 <assert@plt>
mov    %rsp,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
lea    0xe54(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    (%r15),%ebx
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1060 <strlen@plt>
cmp    %eax,%ebx
jge    11dd <process_array+0x5d>
movslq (%r15),%rax
cmpb   $0x5d,(%rsp,%rax,1)
je     11e6 <process_array+0x66>
lea    0x1(%rax),%ebx
mov    %ebx,(%r15)
jmp    11c0 <process_array+0x40>
movslq (%r15),%rax
cmpb   $0x5d,(%rsp,%rax,1)
jne    121a <process_array+0x9a>
test   %eax,%eax
jle    1206 <process_array+0x86>
xor    %ebx,%ebx
nopl   0x0(%rax)
movsbl (%r14,%rbx,1),%edi
add    $0x1,%rbx
call   1030 <putchar@plt>
movslq (%r15),%rax
cmp    %rax,%rbx
jl     11f0 <process_array+0x70>
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
xor    %eax,%eax
call   10a0 <showstack@plt>
lea    0xde2(%rip),%rdi
call   1050 <puts@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"array of \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [31 x i8] c"\0AMismatched array delimiters.\0A\00"
define void @process_array(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca [64 x i8]
%6 = alloca i32
store i8* %0, i8** %3
store i32* %1, i32** %4
%7 = load i32*, i32** %4
store i32 0, i32* %7
store i32 0, i32* %6
%8 = load i8*, i8** %3
%9 = call i32 @assert(i8* %8)
%10 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%11 = load i8*, i8** %3
%12 = call i32 @strcpy(i8* %10, i8* %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %30, %2
%15 = load i32*, i32** %4
%16 = load i32, i32* %15
%17 = load i8*, i8** %3
%18 = call i32 @strlen(i8* %17)
%19 = icmp slt i32 %16, %18
br i1 %19, label %20, label %28
20: ; preds = %14
%21 = load i32*, i32** %4
%22 = load i32, i32* %21
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 93
br label %28
28: ; preds = %20, %14
%29 = phi i1 [ false, %14 ], [ %27, %20 ]
br i1 %29, label %30, label %34
30: ; preds = %28
%31 = load i32*, i32** %4
%32 = load i32, i32* %31
%33 = add nsw i32 %32, 1
store i32 %33, i32* %31
br label %14
34: ; preds = %28
%35 = load i32*, i32** %4
%36 = load i32, i32* %35
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 %37
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 93
br i1 %41, label %42, label %65
42: ; preds = %34
%43 = load i32*, i32** %4
%44 = load i32, i32* %43
%45 = icmp sge i32 %44, 1
br i1 %45, label %46, label %63
46: ; preds = %42
br label %47
47: ; preds = %53, %46
%48 = load i32, i32* %6
%49 = add nsw i32 %48, 1
store i32 %49, i32* %6
%50 = load i32*, i32** %4
%51 = load i32, i32* %50
%52 = icmp slt i32 %48, %51
br i1 %52, label %53, label %62
53: ; preds = %47
%54 = load i8*, i8** %3
%55 = load i32, i32* %6
%56 = sub nsw i32 %55, 1
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8, i8* %54, i64 %57
%59 = load i8, i8* %58
%60 = sext i8 %59 to i32
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %60)
br label %47
62: ; preds = %47
br label %63
63: ; preds = %62, %42
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
65: ; preds = %34
%66 = call i32 (...) @showstack()
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%68 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@.str = [10 x i8] c"array of \00"
@str = [30 x i8] c"\0AMismatched array delimiters.\00"
define void @process_array(i8* %0, i32* nocapture %1) {
%3 = alloca [64 x i8]
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
store i32 0, i32* %1
%5 = tail call i32 @assert(i8* %0)
%6 = call i32 @strcpy(i8* %4, i8* %0)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* %1
%9 = call i32 @strlen(i8* %0)
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %21
11: ; preds = %2, %17
%12 = load i32, i32* %1
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 93
br i1 %16, label %27, label %17
17: ; preds = %11
%18 = add nsw i32 %12, 1
store i32 %18, i32* %1
%19 = call i32 @strlen(i8* %0)
%20 = icmp slt i32 %18, %19
br i1 %20, label %11, label %21
21: ; preds = %17, %2
%22 = load i32, i32* %1
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = icmp eq i8 %25, 93
br i1 %26, label %27, label %42
27: ; preds = %11, %21
%28 = phi i32 [ %22, %21 ], [ %12, %11 ]
%29 = icmp sgt i32 %28, 0
br i1 %29, label %30, label %40
30: ; preds = %27, %30
%31 = phi i64 [ %32, %30 ], [ 0, %27 ]
%32 = add nuw nsw i64 %31, 1
%33 = getelementptr inbounds i8, i8* %0, i64 %31
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = call i32 @putchar(i32 %35)
%37 = load i32, i32* %1
%38 = sext i32 %37 to i64
%39 = icmp slt i64 %32, %38
br i1 %39, label %30, label %40
40: ; preds = %30, %27
%41 = call i32 @putchar(i32 32)
ret void
42: ; preds = %21
%43 = call i32 (...) @showstack()
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%45 = call i32 @exit(i32 -1)
unreachable
}