#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 isValidForSite(char *, char *);
int /*<<< orphan*/ printf(char *);
int main() {
  char *p1 = "12345678901234567890123456789012";
  char *p2 = "12345678901234567890123456789012";
  char *p3 = "12345678901234567890123\0456789012";
  char *p4 = "12345678901234567890123\0456789012";
  if (isValidForSite(p1, p2) == 0) {
    printf("Same strings verified!\n");
  }
  if (isValidForSite(p2, p3) == 1) {
    printf("Malignant string detected!\n");
  }
  if (isValidForSite(p3, p4) == 0) {
    printf("Same strings verified! (both with null characters)\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xebf(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xed5(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <isValidForSite@plt>
cmp    $0x0,%eax
jne    117d <main+0x5d>
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <isValidForSite@plt>
cmp    $0x1,%eax
jne    119f <main+0x7f>
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <isValidForSite@plt>
cmp    $0x0,%eax
jne    11c1 <main+0xa1>
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
mov    %rdi,%rsi
call   1040 <isValidForSite@plt>
test   %eax,%eax
jne    1140 <main+0x20>
lea    0xf54(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
lea    0xed3(%rip),%rsi
call   1040 <isValidForSite@plt>
cmp    $0x1,%eax
jne    1164 <main+0x44>
lea    0xf15(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb6(%rip),%rdi
mov    %rdi,%rsi
call   1040 <isValidForSite@plt>
test   %eax,%eax
jne    1183 <main+0x63>
lea    0xec3(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"12345678901234567890123456789012\00"
@.str.1 = [32 x i8] c"12345678901234567890123%6789012\00"
@.str.2 = [24 x i8] c"Same strings verified!\0A\00"
@.str.3 = [28 x i8] c"Malignant string detected!\0A\00"
@.str.4 = [52 x i8] c"Same strings verified! (both with null characters)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8** %3
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8** %4
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8** %5
%6 = load i8*, i8** %2
%7 = load i8*, i8** %3
%8 = call i32 @isValidForSite(i8* %6, i8* %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
br label %12
12: ; preds = %10, %0
%13 = load i8*, i8** %3
%14 = load i8*, i8** %4
%15 = call i32 @isValidForSite(i8* %13, i8* %14)
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %19
17: ; preds = %12
%18 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
br label %19
19: ; preds = %17, %12
%20 = load i8*, i8** %4
%21 = load i8*, i8** %5
%22 = call i32 @isValidForSite(i8* %20, i8* %21)
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %19
%25 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0))
br label %26
26: ; preds = %24, %19
%27 = load i32, i32* %1
ret i32 %27
}

LLVM IR (-O2):
@.str = [33 x i8] c"12345678901234567890123456789012\00"
@.str.1 = [32 x i8] c"12345678901234567890123%6789012\00"
@str = [51 x i8] c"Same strings verified! (both with null characters)\00"
@str.5 = [27 x i8] c"Malignant string detected!\00"
@str.6 = [23 x i8] c"Same strings verified!\00"
define i32 @main() {
%1 = tail call i32 @isValidForSite(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.6, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
%6 = tail call i32 @isValidForSite(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.5, i64 0, i64 0))
br label %10
10: ; preds = %8, %5
%11 = tail call i32 @isValidForSite(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
br label %15
15: ; preds = %13, %10
ret i32 0
}