#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 */
scalar_t__ strncmp(char const *, char const *, int const);
bool is_redirect(const char *body, int len) {
  static const char *REDIRECT_TOKEN = "#REDIRECT";
  static const int REDIRECT_TOKEN_LEN = 9;
  const int min = (len < REDIRECT_TOKEN_LEN) ? len : REDIRECT_TOKEN_LEN;
  if (len >= REDIRECT_TOKEN_LEN && strncmp(body, REDIRECT_TOKEN, min) == 0) {
    return true;
  }
  return false;
}


x86 assembly (clang, -O0):
<is_redirect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x9,-0x14(%rbp)
jge    1134 <is_redirect+0x24>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1141 <is_redirect+0x31>
mov    $0x9,%eax
mov    %eax,-0x1c(%rbp)
jmp    1141 <is_redirect+0x31>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x9,-0x14(%rbp)
jl     117a <is_redirect+0x6a>
mov    -0x10(%rbp),%rdi
mov    0x2ecc(%rip),%rsi
mov    -0x18(%rbp),%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    117a <is_redirect+0x6a>
movl   $0x1,-0x4(%rbp)
jmp    1181 <is_redirect+0x71>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_redirect>:
cmp    $0x9,%esi
jl     1131 <is_redirect+0x21>
push   %rax
lea    0xee3(%rip),%rsi
mov    $0x9,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
lea    0x8(%rsp),%rsp
je     1134 <is_redirect+0x24>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
@is_redirect.REDIRECT_TOKEN = internal global i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i32 0, i32 0)
@.str = [10 x i8] c"#REDIRECT\00"
@is_redirect.REDIRECT_TOKEN_LEN = internal constant i32 9
define i32 @is_redirect(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 9
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load i32, i32* %5
br label %12
11: ; preds = %2
br label %12
12: ; preds = %11, %9
%13 = phi i32 [ %10, %9 ], [ 9, %11 ]
store i32 %13, i32* %6
%14 = load i32, i32* %5
%15 = icmp sge i32 %14, 9
br i1 %15, label %16, label %23
16: ; preds = %12
%17 = load i8*, i8** %4
%18 = load i8*, i8** @is_redirect.REDIRECT_TOKEN
%19 = load i32, i32* %6
%20 = call i64 @strncmp(i8* %17, i8* %18, i32 %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %16
store i32 1, i32* %3
br label %24
23: ; preds = %16, %12
store i32 0, i32* %3
br label %24
24: ; preds = %23, %22
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
@.str = [10 x i8] c"#REDIRECT\00"
define i32 @is_redirect(i8* %0, i32 %1) {
%3 = icmp sgt i32 %1, 8
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 9)
%6 = icmp eq i64 %5, 0
br i1 %6, label %8, label %7
7: ; preds = %4, %2
br label %8
8: ; preds = %4, %7
%9 = phi i32 [ 0, %7 ], [ 1, %4 ]
ret i32 %9
}