#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*/ printf(char *, ...);
int /*<<< orphan*/ quick_sort(char *, int);
int string_contain(char *, int, char *, int);
int strlen(char *);
int main() {
  char str0[] = "this is a test";
  char str1[] = "asht";
  int len0 = strlen(str0);
  int len1 = strlen(str1);
  quick_sort(str0, len0);
  quick_sort(str1, len1);
  printf("str0 = %s\n", str0);
  printf("str1 = %s\n", str1);
  printf("ret = %d\n", string_contain(str0, len0, str1, len1));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xeb1(%rip),%rax
mov    %rax,-0xf(%rbp)
mov    0xeaf(%rip),%eax
mov    %eax,-0x7(%rbp)
mov    0xea9(%rip),%ax
mov    %ax,-0x3(%rbp)
mov    0xea1(%rip),%al
mov    %al,-0x1(%rbp)
mov    0xe99(%rip),%eax
mov    %eax,-0x14(%rbp)
mov    0xe94(%rip),%al
mov    %al,-0x10(%rbp)
lea    -0xf(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x18(%rbp)
lea    -0x14(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x1c(%rbp)
lea    -0xf(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1060 <quick_sort@plt>
lea    -0x14(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1060 <quick_sort@plt>
lea    -0xf(%rbp),%rsi
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x14(%rbp),%rsi
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xf(%rbp),%rdi
mov    -0x18(%rbp),%esi
lea    -0x14(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1050 <string_contain@plt>
mov    %eax,%esi
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
movabs $0x74736574206120,%rax
mov    %rax,0xf(%rsp)
movabs $0x2073692073696874,%rax
69 73 20
mov    %rax,0x8(%rsp)
movb   $0x0,0x4(%rsp)
movl   $0x74687361,(%rsp)
lea    0x8(%rsp),%r14
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %rsp,%r15
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebx
mov    %r14,%rdi
mov    %ebp,%esi
call   1060 <quick_sort@plt>
mov    %r15,%rdi
mov    %ebx,%esi
call   1060 <quick_sort@plt>
lea    0xe69(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe63(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %r15,%rdx
mov    %ebx,%ecx
call   1050 <string_contain@plt>
lea    0xe4e(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.str0 = [15 x i8] c"this is a test\00"
@__const.main.str1 = [5 x i8] c"asht\00"
@.str = [11 x i8] c"str0 = %s\0A\00"
@.str.1 = [11 x i8] c"str1 = %s\0A\00"
@.str.2 = [10 x i8] c"ret = %d\0A\00"
define i32 @main() {
%1 = alloca [15 x i8]
%2 = alloca [5 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = bitcast [15 x i8]* %1 to i8*
%6 = bitcast [5 x i8]* %2 to i8*
%7 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%8 = call i32 @strlen(i8* %7)
store i32 %8, i32* %3
%9 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%10 = call i32 @strlen(i8* %9)
store i32 %10, i32* %4
%11 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%12 = load i32, i32* %3
%13 = call i32 @quick_sort(i8* %11, i32 %12)
%14 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%15 = load i32, i32* %4
%16 = call i32 @quick_sort(i8* %14, i32 %15)
%17 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %17)
%19 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%22 = load i32, i32* %3
%23 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%24 = load i32, i32* %4
%25 = call i32 @string_contain(i8* %21, i32 %22, i8* %23, i32 %24)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %25)
ret i32 0
}

LLVM IR (-O2):
@__const.main.str0 = [15 x i8] c"this is a test\00"
@__const.main.str1 = [5 x i8] c"asht\00"
@.str = [11 x i8] c"str0 = %s\0A\00"
@.str.1 = [11 x i8] c"str1 = %s\0A\00"
@.str.2 = [10 x i8] c"ret = %d\0A\00"
define i32 @main() {
%1 = alloca [15 x i8]
%2 = alloca [5 x i8]
%3 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%5 = call i32 @strlen(i8* %3)
%6 = call i32 @strlen(i8* %4)
%7 = call i32 @quick_sort(i8* %3, i32 %5)
%8 = call i32 @quick_sort(i8* %4, i32 %6)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %3)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%11 = call i32 @string_contain(i8* %3, i32 %5, i8* %4, i32 %6)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %11)
ret i32 0
}