#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*/ test_str(char *, char *);
int main(void) {
  printf("\nWorking\n");
  test_str("asdfghjk", "f");
  printf("\nEnd\n");
  test_str("asdf<<value == \"hi!\">>qqqq", "qqq");
  printf("\nStrings Identical\n");
  test_str("<<hi>>", "<<hi>>");
  printf("\nStart not in Source\n");
  test_str("<<hi>>", "asdf");
  printf("\nSmall Source\n");
  test_str("s", "sdf");
  printf("\nTwice\n");
  test_str("QQ<<JJ<<FF<<JJ", "JJ");
  printf("\nNull Termination Only\n");
  test_str("mbk", "");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <printf@plt>
lea    0xed3(%rip),%rdi
lea    0xf2a(%rip),%rsi
call   1030 <test_str@plt>
lea    0xec9(%rip),%rdi
call   1040 <printf@plt>
lea    0xec3(%rip),%rdi
lea    0xed3(%rip),%rsi
call   1030 <test_str@plt>
lea    0xecb(%rip),%rdi
call   1040 <printf@plt>
lea    0xed3(%rip),%rsi
mov    %rsi,%rdi
call   1030 <test_str@plt>
lea    0xecb(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb8(%rip),%rdi
lea    0xece(%rip),%rsi
call   1030 <test_str@plt>
lea    0xec7(%rip),%rdi
call   1040 <printf@plt>
lea    0xeca(%rip),%rdi
lea    0xeb0(%rip),%rsi
call   1030 <test_str@plt>
lea    0xeb9(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb5(%rip),%rdi
lea    0xeba(%rip),%rsi
call   1030 <test_str@plt>
lea    0xeb1(%rip),%rdi
call   1040 <printf@plt>
lea    0xebd(%rip),%rdi
lea    0xe24(%rip),%rsi
call   1030 <test_str@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xf1d(%rip),%rdi
call   1040 <puts@plt>
lea    0xecc(%rip),%rdi
lea    0xef3(%rip),%rsi
call   1030 <test_str@plt>
lea    0xf07(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb6(%rip),%rdi
lea    0xec6(%rip),%rsi
call   1030 <test_str@plt>
lea    0xeed(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb2(%rip),%rbx
mov    %rbx,%rdi
mov    %rbx,%rsi
call   1030 <test_str@plt>
lea    0xee2(%rip),%rdi
call   1040 <puts@plt>
lea    0xe9b(%rip),%rsi
mov    %rbx,%rdi
call   1030 <test_str@plt>
lea    0xedc(%rip),%rdi
call   1040 <puts@plt>
lea    0xe85(%rip),%rdi
lea    0xe7a(%rip),%rsi
call   1030 <test_str@plt>
lea    0xecb(%rip),%rdi
call   1040 <puts@plt>
lea    0xe68(%rip),%rdi
lea    0xe6d(%rip),%rsi
call   1030 <test_str@plt>
lea    0xeb3(%rip),%rdi
call   1040 <puts@plt>
lea    0xe58(%rip),%rdi
lea    0xe3a(%rip),%rsi
call   1030 <test_str@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"\0AWorking\0A\00"
@.str.1 = [9 x i8] c"asdfghjk\00"
@.str.2 = [2 x i8] c"f\00"
@.str.3 = [6 x i8] c"\0AEnd\0A\00"
@.str.4 = [27 x i8] c"asdf<<value == \22hi!\22>>qqqq\00"
@.str.5 = [4 x i8] c"qqq\00"
@.str.6 = [20 x i8] c"\0AStrings Identical\0A\00"
@.str.7 = [7 x i8] c"<<hi>>\00"
@.str.8 = [22 x i8] c"\0AStart not in Source\0A\00"
@.str.9 = [5 x i8] c"asdf\00"
@.str.10 = [15 x i8] c"\0ASmall Source\0A\00"
@.str.11 = [2 x i8] c"s\00"
@.str.12 = [4 x i8] c"sdf\00"
@.str.13 = [8 x i8] c"\0ATwice\0A\00"
@.str.14 = [15 x i8] c"QQ<<JJ<<FF<<JJ\00"
@.str.15 = [3 x i8] c"JJ\00"
@.str.16 = [24 x i8] c"\0ANull Termination Only\0A\00"
@.str.17 = [4 x i8] c"mbk\00"
@.str.18 = [1 x i8] zeroinitializer
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @test_str(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%4 = call i32 @test_str(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%6 = call i32 @test_str(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0))
%8 = call i32 @test_str(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0))
%10 = call i32 @test_str(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0))
%12 = call i32 @test_str(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.16, i64 0, i64 0))
%14 = call i32 @test_str(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.18, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"asdfghjk\00"
@.str.2 = [2 x i8] c"f\00"
@.str.4 = [27 x i8] c"asdf<<value == \22hi!\22>>qqqq\00"
@.str.5 = [4 x i8] c"qqq\00"
@.str.7 = [7 x i8] c"<<hi>>\00"
@.str.9 = [5 x i8] c"asdf\00"
@.str.11 = [2 x i8] c"s\00"
@.str.12 = [4 x i8] c"sdf\00"
@.str.14 = [15 x i8] c"QQ<<JJ<<FF<<JJ\00"
@.str.15 = [3 x i8] c"JJ\00"
@.str.17 = [4 x i8] c"mbk\00"
@.str.18 = [1 x i8] zeroinitializer
@str = [9 x i8] c"\0AWorking\00"
@str.19 = [5 x i8] c"\0AEnd\00"
@str.20 = [19 x i8] c"\0AStrings Identical\00"
@str.21 = [21 x i8] c"\0AStart not in Source\00"
@str.22 = [14 x i8] c"\0ASmall Source\00"
@str.23 = [7 x i8] c"\0ATwice\00"
@str.24 = [23 x i8] c"\0ANull Termination Only\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @test_str(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.19, i64 0, i64 0))
%4 = tail call i32 @test_str(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.20, i64 0, i64 0))
%6 = tail call i32 @test_str(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.21, i64 0, i64 0))
%8 = tail call i32 @test_str(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.22, i64 0, i64 0))
%10 = tail call i32 @test_str(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.23, i64 0, i64 0))
%12 = tail call i32 @test_str(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.24, i64 0, i64 0))
%14 = tail call i32 @test_str(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.18, i64 0, i64 0))
ret i32 0
}