#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 pl_startswith(char *, char *);
int /*<<< orphan*/ printf(char *);
int main() {
  char the_string[] = "http://google.com";
  int ret_val;
  ret_val = pl_startswith(the_string, "http://");
  if (ret_val) {
    printf("the_string, does indeed start with http://\n");
  }
  ret_val = pl_startswith(the_string, "ftp://");
  if (!ret_val) {
    printf("And it does not start with ftp://\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec4(%rip),%ax
mov    %ax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
lea    0xeb7(%rip),%rsi
call   1040 <pl_startswith@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1179 <main+0x59>
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
lea    0xec2(%rip),%rsi
call   1040 <pl_startswith@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    11a2 <main+0x82>
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movaps 0xed5(%rip),%xmm0
movaps %xmm0,(%rsp)
movw   $0x6d,0x10(%rsp)
lea    0xf1a(%rip),%rsi
mov    %rsp,%rdi
call   1040 <pl_startswith@plt>
test   %eax,%eax
je     1155 <main+0x35>
lea    0xee4(%rip),%rdi
call   1030 <puts@plt>
lea    0xed1(%rip),%rsi
mov    %rsp,%rdi
call   1040 <pl_startswith@plt>
test   %eax,%eax
jne    1174 <main+0x54>
lea    0xea3(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.the_string = [18 x i8] c"http://google.com\00"
@.str = [8 x i8] c"http://\00"
@.str.1 = [44 x i8] c"the_string, does indeed start with http://\0A\00"
@.str.2 = [7 x i8] c"ftp://\00"
@.str.3 = [35 x i8] c"And it does not start with ftp://\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [18 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [18 x i8]* %2 to i8*
%5 = getelementptr inbounds [18 x i8], [18 x i8]* %2, i64 0, i64 0
%6 = call i32 @pl_startswith(i8* %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %0
%12 = getelementptr inbounds [18 x i8], [18 x i8]* %2, i64 0, i64 0
%13 = call i32 @pl_startswith(i8* %12, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
store i32 %13, i32* %3
%14 = load i32, i32* %3
%15 = icmp ne i32 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %11
%17 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
br label %18
18: ; preds = %16, %11
ret i32 0
}

LLVM IR (-O2):
@__const.main.the_string = [18 x i8] c"http://google.com\00"
@.str = [8 x i8] c"http://\00"
@.str.2 = [7 x i8] c"ftp://\00"
@str = [34 x i8] c"And it does not start with ftp://\00"
@str.4 = [43 x i8] c"the_string, does indeed start with http://\00"
define i32 @main() {
%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 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.4, i64 0, i64 0))
br label %7
7: ; preds = %5, %0
%8 = call i32 @pl_startswith(i8* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
br label %12
12: ; preds = %10, %7
ret i32 0
}