#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 */
char const tolower(unsigned char);
int s_NCBISM_StartsWith(const char *str, const char *pfx) {
  for (; *pfx; ++str, ++pfx) {
    if (tolower((unsigned char)*str) != *pfx) {
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<s_NCBISM_StartsWith>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1179 <s_NCBISM_StartsWith+0x69>
mov    -0x10(%rbp),%rax
movzbl (%rax),%edi
call   1030 <tolower@plt>
movsbl %al,%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1157 <s_NCBISM_StartsWith+0x47>
movl   $0x0,-0x4(%rbp)
jmp    1180 <s_NCBISM_StartsWith+0x70>
jmp    115c <s_NCBISM_StartsWith+0x4c>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1120 <s_NCBISM_StartsWith+0x10>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<s_NCBISM_StartsWith>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x1,%r14d
cmpb   $0x0,(%rsi)
je     114f <s_NCBISM_StartsWith+0x3f>
mov    %rsi,%rbx
mov    %rdi,%r15
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
movzbl (%r15,%rbp,1),%edi
call   1030 <tolower@plt>
cmp    (%rbx,%rbp,1),%al
jne    114c <s_NCBISM_StartsWith+0x3c>
cmpb   $0x0,0x1(%rbx,%rbp,1)
lea    0x1(%rbp),%rbp
jne    1130 <s_NCBISM_StartsWith+0x20>
jmp    114f <s_NCBISM_StartsWith+0x3f>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @s_NCBISM_StartsWith(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
br label %6
6: ; preds = %21, %2
%7 = load i8*, i8** %5
%8 = load i8, i8* %7
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %26
10: ; preds = %6
%11 = load i8*, i8** %4
%12 = load i8, i8* %11
%13 = call signext i8 @tolower(i8 zeroext %12)
%14 = sext i8 %13 to i32
%15 = load i8*, i8** %5
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %14, %17
br i1 %18, label %19, label %20
19: ; preds = %10
store i32 0, i32* %3
br label %27
20: ; preds = %10
br label %21
21: ; preds = %20
%22 = load i8*, i8** %4
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %4
%24 = load i8*, i8** %5
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %5
br label %6
26: ; preds = %6
store i32 1, i32* %3
br label %27
27: ; preds = %26, %19
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
define i32 @s_NCBISM_StartsWith(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %17, label %5
5: ; preds = %2, %12
%6 = phi i8* [ %14, %12 ], [ %1, %2 ]
%7 = phi i8* [ %13, %12 ], [ %0, %2 ]
%8 = load i8, i8* %7
%9 = tail call signext i8 @tolower(i8 zeroext %8)
%10 = load i8, i8* %6
%11 = icmp eq i8 %9, %10
br i1 %11, label %12, label %17
12: ; preds = %5
%13 = getelementptr inbounds i8, i8* %7, i64 1
%14 = getelementptr inbounds i8, i8* %6, i64 1
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %5
17: ; preds = %5, %12, %2
%18 = phi i32 [ 1, %2 ], [ 1, %12 ], [ 0, %5 ]
ret i32 %18
}