#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_equal_str(char *, char *, char *, char *);
int /*<<< orphan*/ free(char *);
char *pl_slice(char *, int, int);
void test_slice_positive_sub_str() {
  char the_string[] = "spam, eggs, and ham";
  char *ret_val;
  ret_val = pl_slice(the_string, 3, 9);
  assert_equal_str("m, egg", ret_val, "test_slice_positive_sub_str",
                   "The substring is not equal to the sliced string.");
  free(ret_val);
}


x86 assembly (clang, -O0):
<test_slice_positive_sub_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xec1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xebe(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xebc(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x3,%esi
mov    $0x9,%edx
call   1050 <pl_slice@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
lea    0xe9b(%rip),%rdi
lea    0xe9b(%rip),%rdx
lea    0xeb0(%rip),%rcx
call   1040 <assert_equal_str@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_slice_positive_sub_str>:
push   %rbx
sub    $0x20,%rsp
movaps 0xec4(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x6d6168,0x10(%rsp)
mov    %rsp,%rdi
mov    $0x3,%esi
mov    $0x9,%edx
call   1050 <pl_slice@plt>
mov    %rax,%rbx
lea    0xeb0(%rip),%rdi
lea    0xeb0(%rip),%rdx
lea    0xec5(%rip),%rcx
mov    %rax,%rsi
call   1040 <assert_equal_str@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.test_slice_positive_sub_str.the_string = [20 x i8] c"spam, eggs, and ham\00"
@.str = [7 x i8] c"m, egg\00"
@.str.1 = [28 x i8] c"test_slice_positive_sub_str\00"
@.str.2 = [49 x i8] c"The substring is not equal to the sliced string.\00"
define void @test_slice_positive_sub_str() {
%1 = alloca [20 x i8]
%2 = alloca i8*
%3 = bitcast [20 x i8]* %1 to i8*
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%5 = call i8* @pl_slice(i8* %4, i32 3, i32 9)
store i8* %5, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 @assert_equal_str(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %6, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
%8 = load i8*, i8** %2
%9 = call i32 @free(i8* %8)
ret void
}

LLVM IR (-O2):
@__const.test_slice_positive_sub_str.the_string = [20 x i8] c"spam, eggs, and ham\00"
@.str = [7 x i8] c"m, egg\00"
@.str.1 = [28 x i8] c"test_slice_positive_sub_str\00"
@.str.2 = [49 x i8] c"The substring is not equal to the sliced string.\00"
define void @test_slice_positive_sub_str() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = call i8* @pl_slice(i8* %2, i32 3, i32 9)
%4 = call i32 @assert_equal_str(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %3, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @free(i8* %3)
ret void
}