#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);
scalar_t__ memcmp(char *, char *, int /*<<< orphan*/);
void memcmp5(char *input) {
  char a[] = {1, 2, 3, 4};
  clang_analyzer_eval(memcmp(a, 0, 0) == 0);
  clang_analyzer_eval(memcmp(0, a, 0) == 0);
  clang_analyzer_eval(memcmp(a, input, 0) == 0);
}


x86 assembly (clang, -O0):
<memcmp5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0xece(%rip),%eax
mov    %eax,-0xc(%rbp)
lea    -0xc(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1030 <memcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <clang_analyzer_eval@plt>
lea    -0xc(%rbp),%rsi
xor    %edx,%edx
mov    %edx,%edi
call   1030 <memcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <clang_analyzer_eval@plt>
lea    -0xc(%rbp),%rdi
mov    -0x8(%rbp),%rsi
xor    %edx,%edx
call   1030 <memcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <clang_analyzer_eval@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memcmp5>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
movl   $0x4030201,0x4(%rsp)
04
lea    0x4(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1030 <memcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <clang_analyzer_eval@plt>
xor    %edi,%edi
mov    %rbx,%rsi
xor    %edx,%edx
call   1030 <memcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <clang_analyzer_eval@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1030 <memcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <clang_analyzer_eval@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.memcmp5.a = [4 x i8] c"\01\02\03\04"
define void @memcmp5(i8* %0) {
%2 = alloca i8*
%3 = alloca [4 x i8]
store i8* %0, i8** %2
%4 = bitcast [4 x i8]* %3 to i8*
%5 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%6 = call i64 @memcmp(i8* %5, i8* null, i32 0)
%7 = icmp eq i64 %6, 0
%8 = zext i1 %7 to i32
%9 = call i32 @clang_analyzer_eval(i32 %8)
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%11 = call i64 @memcmp(i8* null, i8* %10, i32 0)
%12 = icmp eq i64 %11, 0
%13 = zext i1 %12 to i32
%14 = call i32 @clang_analyzer_eval(i32 %13)
%15 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%16 = load i8*, i8** %2
%17 = call i64 @memcmp(i8* %15, i8* %16, i32 0)
%18 = icmp eq i64 %17, 0
%19 = zext i1 %18 to i32
%20 = call i32 @clang_analyzer_eval(i32 %19)
ret void
}

LLVM IR (-O2):
define void @memcmp5(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 67305985, i32* %2
%4 = call i64 @memcmp(i8* %3, i8* null, i32 0)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
%7 = call i32 @clang_analyzer_eval(i32 %6)
%8 = call i64 @memcmp(i8* null, i8* %3, i32 0)
%9 = icmp eq i64 %8, 0
%10 = zext i1 %9 to i32
%11 = call i32 @clang_analyzer_eval(i32 %10)
%12 = call i64 @memcmp(i8* %3, i8* %0, i32 0)
%13 = icmp eq i64 %12, 0
%14 = zext i1 %13 to i32
%15 = call i32 @clang_analyzer_eval(i32 %14)
ret void
}