#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_int(int, int, char *, char *);
int pl_startswith(char *, char *);
void test_startswith() {
  char the_string[] = "http://google.com";
  int ret_val = pl_startswith(the_string, "http://");
  assert_equal_int(1, ret_val, "test_startswith",
                   "Test 1: The string does not start with http://");
  ret_val = pl_startswith(the_string, "https://");
  assert_equal_int(0, ret_val, "test_startswith",
                   "Test 2: The string starts with https://");
}


x86 assembly (clang, -O0):
<test_startswith>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecb(%rip),%ax
mov    %ax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
lea    0xef5(%rip),%rsi
call   1030 <pl_startswith@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
mov    $0x1,%edi
lea    0xea7(%rip),%rdx
lea    0xeb0(%rip),%rcx
call   1040 <assert_equal_int@plt>
lea    -0x20(%rbp),%rdi
lea    0xeee(%rip),%rsi
call   1030 <pl_startswith@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
xor    %edi,%edi
lea    0xe7c(%rip),%rdx
lea    0xeb4(%rip),%rcx
call   1040 <assert_equal_int@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_startswith>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movaps 0xed2(%rip),%xmm0
movaps %xmm0,(%rsp)
movw   $0x6d,0x10(%rsp)
lea    0xf09(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <pl_startswith@plt>
lea    0xec0(%rip),%r14
lea    0xec9(%rip),%rcx
mov    $0x1,%edi
mov    %eax,%esi
mov    %r14,%rdx
call   1040 <assert_equal_int@plt>
lea    0xf01(%rip),%rsi
mov    %rbx,%rdi
call   1030 <pl_startswith@plt>
lea    0xed3(%rip),%rcx
xor    %edi,%edi
mov    %eax,%esi
mov    %r14,%rdx
call   1040 <assert_equal_int@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.test_startswith.the_string = [18 x i8] c"http://google.com\00"
@.str = [8 x i8] c"http://\00"
@.str.1 = [16 x i8] c"test_startswith\00"
@.str.2 = [47 x i8] c"Test 1: The string does not start with http://\00"
@.str.3 = [9 x i8] c"https://\00"
@.str.4 = [40 x i8] c"Test 2: The string starts with https://\00"
define void @test_startswith() {
%1 = alloca [18 x i8]
%2 = alloca i32
%3 = bitcast [18 x i8]* %1 to i8*
%4 = getelementptr inbounds [18 x i8], [18 x i8]* %1, i64 0, i64 0
%5 = call i32 @pl_startswith(i8* %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = call i32 @assert_equal_int(i32 1, i32 %6, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
%8 = getelementptr inbounds [18 x i8], [18 x i8]* %1, i64 0, i64 0
%9 = call i32 @pl_startswith(i8* %8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
store i32 %9, i32* %2
%10 = load i32, i32* %2
%11 = call i32 @assert_equal_int(i32 0, i32 %10, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__const.test_startswith.the_string = [18 x i8] c"http://google.com\00"
@.str = [8 x i8] c"http://\00"
@.str.1 = [16 x i8] c"test_startswith\00"
@.str.2 = [47 x i8] c"Test 1: The string does not start with http://\00"
@.str.3 = [9 x i8] c"https://\00"
@.str.4 = [40 x i8] c"Test 2: The string starts with https://\00"
define void @test_startswith() {
%1 = alloca [18 x i8]
%2 = getelementptr inbounds [18 x i8], [18 x i8]* %1, i64 0, i64 0
%3 = call i32 @pl_startswith(i8* %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @assert_equal_int(i32 1, i32 %3, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @pl_startswith(i8* %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%6 = call i32 @assert_equal_int(i32 0, i32 %5, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0))
ret void
}