#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*/ clang_analyzer_eval(int);
int strcasecmp(char *, char *);
void strcasecmp_check_modelling() {
  char *x = "aa";
  char *y = "a";
  clang_analyzer_eval(strcasecmp(x, y) > 0);
  clang_analyzer_eval(strcasecmp(x, y) <= 0);
  clang_analyzer_eval(strcasecmp(x, y) > 1);
  clang_analyzer_eval(strcasecmp(y, x) < 0);
  clang_analyzer_eval(strcasecmp(y, x) >= 0);
  clang_analyzer_eval(strcasecmp(y, x) < -1);
}


x86 assembly (clang, -O0):
<strcasecmp_check_modelling>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xec7(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <clang_analyzer_eval@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
setle  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <clang_analyzer_eval@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x1,%eax
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <clang_analyzer_eval@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <clang_analyzer_eval@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <clang_analyzer_eval@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcasecmp@plt>
cmp    $0xffffffff,%eax
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <clang_analyzer_eval@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcasecmp_check_modelling>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%r14
lea    0xecf(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
xor    %edi,%edi
test   %eax,%eax
setg   %dil
call   1040 <clang_analyzer_eval@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
xor    %edi,%edi
test   %eax,%eax
setle  %dil
call   1040 <clang_analyzer_eval@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
xor    %edi,%edi
cmp    $0x2,%eax
setge  %dil
call   1040 <clang_analyzer_eval@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcasecmp@plt>
shr    $0x1f,%eax
mov    %eax,%edi
call   1040 <clang_analyzer_eval@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcasecmp@plt>
not    %eax
shr    $0x1f,%eax
mov    %eax,%edi
call   1040 <clang_analyzer_eval@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcasecmp@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
setl   %dil
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <clang_analyzer_eval@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"aa\00"
@.str.1 = [2 x i8] c"a\00"
define void @strcasecmp_check_modelling() {
%1 = alloca i8*
%2 = alloca i8*
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %2
%3 = load i8*, i8** %1
%4 = load i8*, i8** %2
%5 = call i32 @strcasecmp(i8* %3, i8* %4)
%6 = icmp sgt i32 %5, 0
%7 = zext i1 %6 to i32
%8 = call i32 @clang_analyzer_eval(i32 %7)
%9 = load i8*, i8** %1
%10 = load i8*, i8** %2
%11 = call i32 @strcasecmp(i8* %9, i8* %10)
%12 = icmp sle i32 %11, 0
%13 = zext i1 %12 to i32
%14 = call i32 @clang_analyzer_eval(i32 %13)
%15 = load i8*, i8** %1
%16 = load i8*, i8** %2
%17 = call i32 @strcasecmp(i8* %15, i8* %16)
%18 = icmp sgt i32 %17, 1
%19 = zext i1 %18 to i32
%20 = call i32 @clang_analyzer_eval(i32 %19)
%21 = load i8*, i8** %2
%22 = load i8*, i8** %1
%23 = call i32 @strcasecmp(i8* %21, i8* %22)
%24 = icmp slt i32 %23, 0
%25 = zext i1 %24 to i32
%26 = call i32 @clang_analyzer_eval(i32 %25)
%27 = load i8*, i8** %2
%28 = load i8*, i8** %1
%29 = call i32 @strcasecmp(i8* %27, i8* %28)
%30 = icmp sge i32 %29, 0
%31 = zext i1 %30 to i32
%32 = call i32 @clang_analyzer_eval(i32 %31)
%33 = load i8*, i8** %2
%34 = load i8*, i8** %1
%35 = call i32 @strcasecmp(i8* %33, i8* %34)
%36 = icmp slt i32 %35, -1
%37 = zext i1 %36 to i32
%38 = call i32 @clang_analyzer_eval(i32 %37)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"aa\00"
@.str.1 = [2 x i8] c"a\00"
define void @strcasecmp_check_modelling() {
%1 = tail call i32 @strcasecmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp sgt i32 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @clang_analyzer_eval(i32 %3)
%5 = tail call i32 @strcasecmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp slt i32 %5, 1
%7 = zext i1 %6 to i32
%8 = tail call i32 @clang_analyzer_eval(i32 %7)
%9 = tail call i32 @strcasecmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp sgt i32 %9, 1
%11 = zext i1 %10 to i32
%12 = tail call i32 @clang_analyzer_eval(i32 %11)
%13 = tail call i32 @strcasecmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%14 = lshr i32 %13, 31
%15 = tail call i32 @clang_analyzer_eval(i32 %14)
%16 = tail call i32 @strcasecmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%17 = xor i32 %16, -1
%18 = lshr i32 %17, 31
%19 = tail call i32 @clang_analyzer_eval(i32 %18)
%20 = tail call i32 @strcasecmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%21 = icmp slt i32 %20, -1
%22 = zext i1 %21 to i32
%23 = tail call i32 @clang_analyzer_eval(i32 %22)
ret void
}