#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*/ htmly_extract_header(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *);
scalar_t__ strcmp(char *, char *);
int test_htmly_extract_header() {
  char teststr[256], header[256];
  sprintf(teststr, "<--t This is the header t-->\n");
  htmly_extract_header(teststr, header);
  if (strcmp(header, "This is the header") != 0) {
    printf("%s\n", header);
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<test_htmly_extract_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
lea    -0x110(%rbp),%rdi
lea    0xea7(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0x110(%rbp),%rdi
lea    -0x210(%rbp),%rsi
call   1040 <htmly_extract_header@plt>
lea    -0x210(%rbp),%rdi
lea    0xe9f(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     11ad <test_htmly_extract_header+0x6d>
lea    -0x210(%rbp),%rsi
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11b4 <test_htmly_extract_header+0x74>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_htmly_extract_header>:
push   %rbx
sub    $0x200,%rsp
movups 0xec1(%rip),%xmm0
movaps %xmm0,(%rsp)
movups 0xec4(%rip),%xmm0
movups %xmm0,0xe(%rsp)
mov    %rsp,%rdi
lea    0x100(%rsp),%rbx
mov    %rbx,%rsi
call   1040 <htmly_extract_header@plt>
lea    0xeb5(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1191 <test_htmly_extract_header+0x61>
lea    0xeb4(%rip),%rdi
lea    0x100(%rsp),%rsi
call   1030 <printf@plt>
mov    $0x1,%eax
jmp    1193 <test_htmly_extract_header+0x63>
xor    %eax,%eax
add    $0x200,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [30 x i8] c"<--t This is the header t-->\0A\00"
@.str.1 = [19 x i8] c"This is the header\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @test_htmly_extract_header() {
%1 = alloca i32
%2 = alloca [256 x i8]
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%8 = call i32 @htmly_extract_header(i8* %6, i8* %7)
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%10 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %0
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %13)
store i32 1, i32* %1
br label %16
15: ; preds = %0
store i32 0, i32* %1
br label %16
16: ; preds = %15, %12
%17 = load i32, i32* %1
ret i32 %17
}

LLVM IR (-O2):
@.str = [30 x i8] c"<--t This is the header t-->\0A\00"
@.str.1 = [19 x i8] c"This is the header\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @test_htmly_extract_header() {
%1 = alloca [256 x i8]
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%5 = call i32 @htmly_extract_header(i8* %3, i8* %4)
%6 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %4)
br label %10
10: ; preds = %0, %8
%11 = phi i32 [ 1, %8 ], [ 0, %0 ]
ret i32 %11
}