#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(int);
int block(char *, size_t, char const *);
void test_host(const char *needle, size_t len) {
  assert(block("http://%.*s", len, needle));
  assert(block("http://subdomain.%.*s", len, needle));
  assert(block("http://another.subdomain.%.*s", len, needle));
  assert(!block("http://%.*s.xyz", len, needle));
  assert(!block("http://subdomain.%.*s.xyz", len, needle));
  assert(!block("http://subdomain_%.*s.xyz", len, needle));
  assert(!block("http://another.subdomain.%.*s.xyz", len, needle));
}


x86 assembly (clang, -O0):
<test_host>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0xec1(%rip),%rdi
call   1040 <block@plt>
mov    %eax,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0xeb2(%rip),%rdi
call   1040 <block@plt>
mov    %eax,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0xead(%rip),%rdi
call   1040 <block@plt>
mov    %eax,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0xeb0(%rip),%rdi
call   1040 <block@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0xe9a(%rip),%rdi
call   1040 <block@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0xe8e(%rip),%rdi
call   1040 <block@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0xe82(%rip),%rdi
call   1040 <block@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_host>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xecf(%rip),%rdi
mov    %rbx,%rdx
call   1040 <block@plt>
mov    %eax,%edi
call   1030 <assert@plt>
lea    0xec5(%rip),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <block@plt>
mov    %eax,%edi
call   1030 <assert@plt>
lea    0xec2(%rip),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <block@plt>
mov    %eax,%edi
call   1030 <assert@plt>
lea    0xec7(%rip),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <block@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1030 <assert@plt>
lea    0xeb8(%rip),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <block@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1030 <assert@plt>
lea    0xeb3(%rip),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <block@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1030 <assert@plt>
lea    0xeae(%rip),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <block@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <assert@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"http://%.*s\00"
@.str.1 = [22 x i8] c"http://subdomain.%.*s\00"
@.str.2 = [30 x i8] c"http://another.subdomain.%.*s\00"
@.str.3 = [16 x i8] c"http://%.*s.xyz\00"
@.str.4 = [26 x i8] c"http://subdomain.%.*s.xyz\00"
@.str.5 = [26 x i8] c"http://subdomain_%.*s.xyz\00"
@.str.6 = [34 x i8] c"http://another.subdomain.%.*s.xyz\00"
define void @test_host(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i8*, i8** %3
%7 = call i32 @block(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i64 %5, i8* %6)
%8 = call i32 @assert(i32 %7)
%9 = load i64, i64* %4
%10 = load i8*, i8** %3
%11 = call i32 @block(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i64 %9, i8* %10)
%12 = call i32 @assert(i32 %11)
%13 = load i64, i64* %4
%14 = load i8*, i8** %3
%15 = call i32 @block(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i64 %13, i8* %14)
%16 = call i32 @assert(i32 %15)
%17 = load i64, i64* %4
%18 = load i8*, i8** %3
%19 = call i32 @block(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i64 %17, i8* %18)
%20 = icmp ne i32 %19, 0
%21 = xor i1 %20, true
%22 = zext i1 %21 to i32
%23 = call i32 @assert(i32 %22)
%24 = load i64, i64* %4
%25 = load i8*, i8** %3
%26 = call i32 @block(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i64 %24, i8* %25)
%27 = icmp ne i32 %26, 0
%28 = xor i1 %27, true
%29 = zext i1 %28 to i32
%30 = call i32 @assert(i32 %29)
%31 = load i64, i64* %4
%32 = load i8*, i8** %3
%33 = call i32 @block(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i64 %31, i8* %32)
%34 = icmp ne i32 %33, 0
%35 = xor i1 %34, true
%36 = zext i1 %35 to i32
%37 = call i32 @assert(i32 %36)
%38 = load i64, i64* %4
%39 = load i8*, i8** %3
%40 = call i32 @block(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0), i64 %38, i8* %39)
%41 = icmp ne i32 %40, 0
%42 = xor i1 %41, true
%43 = zext i1 %42 to i32
%44 = call i32 @assert(i32 %43)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"http://%.*s\00"
@.str.1 = [22 x i8] c"http://subdomain.%.*s\00"
@.str.2 = [30 x i8] c"http://another.subdomain.%.*s\00"
@.str.3 = [16 x i8] c"http://%.*s.xyz\00"
@.str.4 = [26 x i8] c"http://subdomain.%.*s.xyz\00"
@.str.5 = [26 x i8] c"http://subdomain_%.*s.xyz\00"
@.str.6 = [34 x i8] c"http://another.subdomain.%.*s.xyz\00"
define void @test_host(i8* %0, i64 %1) {
%3 = tail call i32 @block(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i64 %1, i8* %0)
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 @block(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i64 %1, i8* %0)
%6 = tail call i32 @assert(i32 %5)
%7 = tail call i32 @block(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i64 %1, i8* %0)
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i32 @block(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i64 %1, i8* %0)
%10 = icmp eq i32 %9, 0
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = tail call i32 @block(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i64 %1, i8* %0)
%14 = icmp eq i32 %13, 0
%15 = zext i1 %14 to i32
%16 = tail call i32 @assert(i32 %15)
%17 = tail call i32 @block(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i64 %1, i8* %0)
%18 = icmp eq i32 %17, 0
%19 = zext i1 %18 to i32
%20 = tail call i32 @assert(i32 %19)
%21 = tail call i32 @block(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0), i64 %1, i8* %0)
%22 = icmp eq i32 %21, 0
%23 = zext i1 %22 to i32
%24 = tail call i32 @assert(i32 %23)
ret void
}