#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);
char *strchr(char *, char);
scalar_t__ strcmp(char *, char *);
scalar_t__ strncmp(char *, char *, int);
int main() {
  char *s = "hi there";
  assert(strcmp("hi", "hi") == 0);
  assert(strcmp("yo", "hi") > 0);
  assert(strcmp("a", "b") < 0);
  assert(strcmp("", "") == 0);
  assert(strcmp("aaa", "aaz") < 0);
  assert(strcmp("aaa", "") > 0);
  assert(strcmp("", "aaa") < 0);
  assert(strncmp("hi", "hia", 2) == 0);
  assert(strncmp("hello", "henry", 2) == 0);
  assert(strncmp("hello", "henry", 3) < 0);
  assert(strchr(s, 'i') == s + 1);
  assert(!strchr(s, 'z'));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xeaf(%rip),%rsi
mov    %rsi,%rdi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xe92(%rip),%rdi
lea    0xe88(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xe75(%rip),%rdi
lea    0xe6a(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xe52(%rip),%rsi
mov    %rsi,%rdi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xe2f(%rip),%rdi
lea    0xe2c(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xe0b(%rip),%rdi
lea    0xe07(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xdea(%rip),%rdi
lea    0xde0(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xdbb(%rip),%rdi
lea    0xdc4(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xda6(%rip),%rdi
lea    0xda5(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xd7d(%rip),%rdi
lea    0xd7c(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    $0x69,%esi
call   1040 <strchr@plt>
mov    -0x8(%rbp),%rcx
add    $0x1,%rcx
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    $0x7a,%esi
call   1040 <strchr@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
lea    0xec4(%rip),%r14
mov    %r14,%rdi
mov    %r14,%rsi
call   1040 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1050 <assert@plt>
lea    0xea7(%rip),%rdi
mov    %r14,%rsi
call   1040 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
setg   %dil
call   1050 <assert@plt>
lea    0xe91(%rip),%rdi
lea    0xe86(%rip),%rsi
call   1040 <strcmp@plt>
shr    $0x3f,%rax
mov    %eax,%edi
call   1050 <assert@plt>
lea    0xe74(%rip),%r15
mov    %r15,%rdi
mov    %r15,%rsi
call   1040 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1050 <assert@plt>
lea    0xe51(%rip),%rbx
lea    0xe4e(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
shr    $0x3f,%rax
mov    %eax,%edi
call   1050 <assert@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
setg   %dil
call   1050 <assert@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
shr    $0x3f,%rax
mov    %eax,%edi
call   1050 <assert@plt>
lea    0xe09(%rip),%rsi
mov    %r14,%rdi
mov    $0x2,%edx
call   1030 <strncmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1050 <assert@plt>
lea    0xdeb(%rip),%rbx
lea    0xdea(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
shr    $0x3f,%rax
mov    %eax,%edi
call   1050 <assert@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [9 x i8] c"hi there\00"
@.str.1 = [3 x i8] c"hi\00"
@.str.2 = [3 x i8] c"yo\00"
@.str.3 = [2 x i8] c"a\00"
@.str.4 = [2 x i8] c"b\00"
@.str.5 = [1 x i8] zeroinitializer
@.str.6 = [4 x i8] c"aaa\00"
@.str.7 = [4 x i8] c"aaz\00"
@.str.8 = [4 x i8] c"hia\00"
@.str.9 = [6 x i8] c"hello\00"
@.str.10 = [6 x i8] c"henry\00"
define i32 @main() {
%1 = alloca i8*
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %1
%2 = call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
%4 = zext i1 %3 to i32
%5 = call i32 @assert(i32 %4)
%6 = call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp sgt i64 %6, 0
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = call i64 @strcmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%11 = icmp slt i64 %10, 0
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = call i64 @strcmp(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%19 = icmp slt i64 %18, 0
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0))
%23 = icmp sgt i64 %22, 0
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
%26 = call i64 @strcmp(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%27 = icmp slt i64 %26, 0
%28 = zext i1 %27 to i32
%29 = call i32 @assert(i32 %28)
%30 = call i64 @strncmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 2)
%31 = icmp eq i64 %30, 0
%32 = zext i1 %31 to i32
%33 = call i32 @assert(i32 %32)
%34 = call i64 @strncmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i32 2)
%35 = icmp eq i64 %34, 0
%36 = zext i1 %35 to i32
%37 = call i32 @assert(i32 %36)
%38 = call i64 @strncmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i32 3)
%39 = icmp slt i64 %38, 0
%40 = zext i1 %39 to i32
%41 = call i32 @assert(i32 %40)
%42 = load i8*, i8** %1
%43 = call i8* @strchr(i8* %42, i8 signext 105)
%44 = load i8*, i8** %1
%45 = getelementptr inbounds i8, i8* %44, i64 1
%46 = icmp eq i8* %43, %45
%47 = zext i1 %46 to i32
%48 = call i32 @assert(i32 %47)
%49 = load i8*, i8** %1
%50 = call i8* @strchr(i8* %49, i8 signext 122)
%51 = icmp ne i8* %50, null
%52 = xor i1 %51, true
%53 = zext i1 %52 to i32
%54 = call i32 @assert(i32 %53)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"hi\00"
@.str.2 = [3 x i8] c"yo\00"
@.str.3 = [2 x i8] c"a\00"
@.str.4 = [2 x i8] c"b\00"
@.str.5 = [1 x i8] zeroinitializer
@.str.6 = [4 x i8] c"aaa\00"
@.str.7 = [4 x i8] c"aaz\00"
@.str.8 = [4 x i8] c"hia\00"
@.str.9 = [6 x i8] c"hello\00"
@.str.10 = [6 x i8] c"henry\00"
define i32 @main() {
%1 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp sgt i64 %5, 0
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i64 @strcmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%10 = lshr i64 %9, 63
%11 = trunc i64 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = tail call i64 @strcmp(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
%15 = zext i1 %14 to i32
%16 = tail call i32 @assert(i32 %15)
%17 = tail call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%18 = lshr i64 %17, 63
%19 = trunc i64 %18 to i32
%20 = tail call i32 @assert(i32 %19)
%21 = tail call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0))
%22 = icmp sgt i64 %21, 0
%23 = zext i1 %22 to i32
%24 = tail call i32 @assert(i32 %23)
%25 = tail call i64 @strcmp(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%26 = lshr i64 %25, 63
%27 = trunc i64 %26 to i32
%28 = tail call i32 @assert(i32 %27)
%29 = tail call i64 @strncmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 2)
%30 = icmp eq i64 %29, 0
%31 = zext i1 %30 to i32
%32 = tail call i32 @assert(i32 %31)
%33 = tail call i64 @strncmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i32 2)
%34 = icmp eq i64 %33, 0
%35 = zext i1 %34 to i32
%36 = tail call i32 @assert(i32 %35)
%37 = tail call i64 @strncmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i32 3)
%38 = lshr i64 %37, 63
%39 = trunc i64 %38 to i32
%40 = tail call i32 @assert(i32 %39)
%41 = tail call i32 @assert(i32 1)
%42 = tail call i32 @assert(i32 1)
ret i32 0
}