#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);
scalar_t__ strcasecmp(char *, char *);
scalar_t__ strcmp(char *, char *);
char *strdup(char *);
int strlen(char *);
scalar_t__ strncasecmp(char *, char *, int);
scalar_t__ strncmp(char *, char *, int);
int main() {
  char str[500] = "Hello";
  assert(strcmp(str, "Hello") == 0);
  assert(strncmp(str, "Hello", 5) == 0);
  assert(strcasecmp(str, "HELLO") == 0);
  assert(strncasecmp(str, "HELLO", 5) == 0);
  assert(strcmp(str, "\xff") < 0);
  assert(strncmp("ASDxx", "ASDyy", 3) == 0);
  assert(strlen(str) == 5);
  assert(strcmp(str, strdup(str)) == 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x200(%rbp),%rdi
xor    %esi,%esi
mov    $0x1f4,%edx
call   1060 <memset@plt>
movb   $0x48,-0x200(%rbp)
movb   $0x65,-0x1ff(%rbp)
movb   $0x6c,-0x1fe(%rbp)
movb   $0x6c,-0x1fd(%rbp)
movb   $0x6f,-0x1fc(%rbp)
lea    -0x200(%rbp),%rdi
lea    0xe2a(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
lea    -0x200(%rbp),%rdi
lea    0xe06(%rip),%rsi
mov    $0x5,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
lea    -0x200(%rbp),%rdi
lea    0xde3(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
lea    -0x200(%rbp),%rdi
lea    0xdbf(%rip),%rsi
mov    $0x5,%edx
call   1090 <strncasecmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
lea    -0x200(%rbp),%rdi
lea    0xd9c(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
lea    0xd81(%rip),%rdi
lea    0xd80(%rip),%rsi
mov    $0x3,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
lea    -0x200(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x5,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
lea    -0x200(%rbp),%rax
mov    %rax,-0x208(%rbp)
lea    -0x200(%rbp),%rdi
call   10a0 <strdup@plt>
mov    -0x208(%rbp),%rdi
mov    %rax,%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
xor    %eax,%eax
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x1f8,%rsp
mov    %rsp,%r14
mov    $0x1f4,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1060 <memset@plt>
movl   $0x6c6c6548,(%rsp)
movb   $0x6f,0x4(%rsp)
lea    0xe51(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x5,%edx
call   1040 <strncmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
lea    0xe19(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x5,%edx
call   1090 <strncasecmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
lea    0xde1(%rip),%rsi
mov    %r14,%rdi
call   1070 <strcmp@plt>
shr    $0x3f,%rax
mov    %eax,%edi
call   1080 <assert@plt>
lea    0xdc9(%rip),%rdi
lea    0xdc8(%rip),%rsi
mov    $0x3,%edx
call   1040 <strncmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
mov    %r14,%rdi
call   1050 <strlen@plt>
xor    %edi,%edi
cmp    $0x5,%eax
sete   %dil
call   1080 <assert@plt>
mov    %r14,%rdi
call   10a0 <strdup@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1070 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
xor    %eax,%eax
add    $0x1f8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"Hello\00"
@.str.1 = [6 x i8] c"HELLO\00"
@.str.2 = [2 x i8] c"\FF\00"
@.str.3 = [6 x i8] c"ASDxx\00"
@.str.4 = [6 x i8] c"ASDyy\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [500 x i8]
store i32 0, i32* %1
%3 = bitcast [500 x i8]* %2 to i8*
%4 = bitcast i8* %3 to [500 x i8]*
%5 = getelementptr inbounds [500 x i8], [500 x i8]* %4, i32 0, i32 0
store i8 72, i8* %5
%6 = getelementptr inbounds [500 x i8], [500 x i8]* %4, i32 0, i32 1
store i8 101, i8* %6
%7 = getelementptr inbounds [500 x i8], [500 x i8]* %4, i32 0, i32 2
store i8 108, i8* %7
%8 = getelementptr inbounds [500 x i8], [500 x i8]* %4, i32 0, i32 3
store i8 108, i8* %8
%9 = getelementptr inbounds [500 x i8], [500 x i8]* %4, i32 0, i32 4
store i8 111, i8* %9
%10 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 0
%11 = call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 0
%16 = call i64 @strncmp(i8* %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
%17 = icmp eq i64 %16, 0
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 0
%21 = call i64 @strcasecmp(i8* %20, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
%23 = zext i1 %22 to i32
%24 = call i32 @assert(i32 %23)
%25 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 0
%26 = call i64 @strncasecmp(i8* %25, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 5)
%27 = icmp eq i64 %26, 0
%28 = zext i1 %27 to i32
%29 = call i32 @assert(i32 %28)
%30 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 0
%31 = call i64 @strcmp(i8* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%32 = icmp slt i64 %31, 0
%33 = zext i1 %32 to i32
%34 = call i32 @assert(i32 %33)
%35 = call i64 @strncmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 3)
%36 = icmp eq i64 %35, 0
%37 = zext i1 %36 to i32
%38 = call i32 @assert(i32 %37)
%39 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 0
%40 = call i32 @strlen(i8* %39)
%41 = icmp eq i32 %40, 5
%42 = zext i1 %41 to i32
%43 = call i32 @assert(i32 %42)
%44 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 0
%45 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 0
%46 = call i8* @strdup(i8* %45)
%47 = call i64 @strcmp(i8* %44, i8* %46)
%48 = icmp eq i64 %47, 0
%49 = zext i1 %48 to i32
%50 = call i32 @assert(i32 %49)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"Hello\00"
@.str.1 = [6 x i8] c"HELLO\00"
@.str.2 = [2 x i8] c"\FF\00"
@.str.3 = [6 x i8] c"ASDxx\00"
@.str.4 = [6 x i8] c"ASDyy\00"
define i32 @main() {
%1 = alloca [500 x i8]
%2 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 0
store i8 72, i8* %2
%3 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 1
store i8 101, i8* %3
%4 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 2
store i8 108, i8* %4
%5 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 3
store i8 108, i8* %5
%6 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 4
store i8 111, i8* %6
%7 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = call i64 @strncmp(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
%12 = icmp eq i64 %11, 0
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = call i64 @strcasecmp(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = call i64 @strncasecmp(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 5)
%20 = icmp eq i64 %19, 0
%21 = zext i1 %20 to i32
%22 = call i32 @assert(i32 %21)
%23 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%24 = lshr i64 %23, 63
%25 = trunc i64 %24 to i32
%26 = call i32 @assert(i32 %25)
%27 = call i64 @strncmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 3)
%28 = icmp eq i64 %27, 0
%29 = zext i1 %28 to i32
%30 = call i32 @assert(i32 %29)
%31 = call i32 @strlen(i8* %2)
%32 = icmp eq i32 %31, 5
%33 = zext i1 %32 to i32
%34 = call i32 @assert(i32 %33)
%35 = call i8* @strdup(i8* %2)
%36 = call i64 @strcmp(i8* %2, i8* %35)
%37 = icmp eq i64 %36, 0
%38 = zext i1 %37 to i32
%39 = call i32 @assert(i32 %38)
ret i32 0
}