#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 */
typedef int /*<<< orphan*/ text;

/* Variables and functions */
int /*<<< orphan*/ process(char *, char const **, int, char *);
int /*<<< orphan*/ puts(char *);
int main(void) {
  char res[100];
  const char *text[] = {"abcd", "bacs", "dac", "xab", "dxabssdc"};
  process(res, text, (sizeof(text) / (sizeof((text)[0]))), "b");
  puts(res);
  process(res, text, (sizeof(text) / (sizeof((text)[0]))), "x");
  puts(res);
  process(res, text, (sizeof(text) / (sizeof((text)[0]))), "bxd");
  puts(res);
  process(res, text, (sizeof(text) / (sizeof((text)[0]))), "xabcd");
  puts(res);
  process(res, text, (sizeof(text) / (sizeof((text)[0]))),
          "aasdasdasdas12xabcd");
  puts(res);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
lea    0xecf(%rip),%rax
mov    %rax,-0xa0(%rbp)
lea    0xe96(%rip),%rax
mov    %rax,-0x98(%rbp)
lea    0xe8d(%rip),%rax
mov    %rax,-0x90(%rbp)
lea    0xe83(%rip),%rax
mov    %rax,-0x88(%rbp)
lea    0xe79(%rip),%rax
mov    %rax,-0x80(%rbp)
lea    -0x70(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
mov    $0x5,%edx
lea    0xe5c(%rip),%rcx
call   1050 <process@plt>
lea    -0x70(%rbp),%rdi
call   1030 <puts@plt>
lea    -0x70(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
mov    $0x5,%edx
lea    0xe42(%rip),%rcx
call   1050 <process@plt>
lea    -0x70(%rbp),%rdi
call   1030 <puts@plt>
lea    -0x70(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
mov    $0x5,%edx
lea    0xe1f(%rip),%rcx
call   1050 <process@plt>
lea    -0x70(%rbp),%rdi
call   1030 <puts@plt>
lea    -0x70(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
mov    $0x5,%edx
lea    0xe0c(%rip),%rcx
call   1050 <process@plt>
lea    -0x70(%rbp),%rdi
call   1030 <puts@plt>
lea    -0x70(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
mov    $0x5,%edx
lea    0xdd9(%rip),%rcx
call   1050 <process@plt>
lea    -0x70(%rbp),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x98,%rsp
lea    0xefa(%rip),%rax
mov    %rax,(%rsp)
lea    0xec4(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0xebd(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xeb5(%rip),%rax
mov    %rax,0x18(%rsp)
lea    0xead(%rip),%rax
mov    %rax,0x20(%rsp)
lea    0xe9f(%rip),%rcx
lea    0x30(%rsp),%rbx
mov    %rsp,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x5,%edx
call   1040 <process@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe83(%rip),%rcx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x5,%edx
call   1040 <process@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe66(%rip),%rcx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x5,%edx
call   1040 <process@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe59(%rip),%rcx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x5,%edx
call   1040 <process@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe2c(%rip),%rcx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x5,%edx
call   1040 <process@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"abcd\00"
@.str.1 = [5 x i8] c"bacs\00"
@.str.2 = [4 x i8] c"dac\00"
@.str.3 = [4 x i8] c"xab\00"
@.str.4 = [9 x i8] c"dxabssdc\00"
@.str.5 = [2 x i8] c"b\00"
@.str.6 = [2 x i8] c"x\00"
@.str.7 = [4 x i8] c"bxd\00"
@.str.8 = [6 x i8] c"xabcd\00"
@.str.9 = [20 x i8] c"aasdasdasdas12xabcd\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca [5 x i8*]
store i32 0, i32* %1
%4 = bitcast [5 x i8*]* %3 to i8*
%5 = bitcast i8* %4 to [5 x i8*]*
%6 = getelementptr inbounds [5 x i8*], [5 x i8*]* %5, i32 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8** %6
%7 = getelementptr inbounds [5 x i8*], [5 x i8*]* %5, i32 0, i32 1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8** %7
%8 = getelementptr inbounds [5 x i8*], [5 x i8*]* %5, i32 0, i32 2
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8** %8
%9 = getelementptr inbounds [5 x i8*], [5 x i8*]* %5, i32 0, i32 3
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8** %9
%10 = getelementptr inbounds [5 x i8*], [5 x i8*]* %5, i32 0, i32 4
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i32 0, i32 0), i8** %10
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%12 = getelementptr inbounds [5 x i8*], [5 x i8*]* %3, i64 0, i64 0
%13 = call i32 @process(i8* %11, i8** %12, i32 5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%15 = call i32 @puts(i8* %14)
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%17 = getelementptr inbounds [5 x i8*], [5 x i8*]* %3, i64 0, i64 0
%18 = call i32 @process(i8* %16, i8** %17, i32 5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%20 = call i32 @puts(i8* %19)
%21 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%22 = getelementptr inbounds [5 x i8*], [5 x i8*]* %3, i64 0, i64 0
%23 = call i32 @process(i8* %21, i8** %22, i32 5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%24 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%25 = call i32 @puts(i8* %24)
%26 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%27 = getelementptr inbounds [5 x i8*], [5 x i8*]* %3, i64 0, i64 0
%28 = call i32 @process(i8* %26, i8** %27, i32 5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%29 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%30 = call i32 @puts(i8* %29)
%31 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%32 = getelementptr inbounds [5 x i8*], [5 x i8*]* %3, i64 0, i64 0
%33 = call i32 @process(i8* %31, i8** %32, i32 5, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0))
%34 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%35 = call i32 @puts(i8* %34)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"abcd\00"
@.str.1 = [5 x i8] c"bacs\00"
@.str.2 = [4 x i8] c"dac\00"
@.str.3 = [4 x i8] c"xab\00"
@.str.4 = [9 x i8] c"dxabssdc\00"
@.str.5 = [2 x i8] c"b\00"
@.str.6 = [2 x i8] c"x\00"
@.str.7 = [4 x i8] c"bxd\00"
@.str.8 = [6 x i8] c"xabcd\00"
@.str.9 = [20 x i8] c"aasdasdasdas12xabcd\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [5 x i8*]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = bitcast [5 x i8*]* %2 to i8*
%5 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %5
%6 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %6
%7 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 2
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8** %7
%8 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 3
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8** %8
%9 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 4
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8** %9
%10 = call i32 @process(i8* %3, i8** %5, i32 5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%11 = call i32 @puts(i8* %3)
%12 = call i32 @process(i8* %3, i8** %5, i32 5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%13 = call i32 @puts(i8* %3)
%14 = call i32 @process(i8* %3, i8** %5, i32 5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%15 = call i32 @puts(i8* %3)
%16 = call i32 @process(i8* %3, i8** %5, i32 5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%17 = call i32 @puts(i8* %3)
%18 = call i32 @process(i8* %3, i8** %5, i32 5, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0))
%19 = call i32 @puts(i8* %3)
ret i32 0
}