#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);
void testAnd(int i, int *p) {
  int *nullP = 0;
  int *knownP = &i;
  clang_analyzer_eval((knownP && knownP) == 1);
  clang_analyzer_eval((knownP && nullP) == 0);
  clang_analyzer_eval((knownP && p) == 1);
}


x86 assembly (clang, -O0):
<testAnd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x20(%rbp)
mov    %al,-0x21(%rbp)
je     114a <testAnd+0x3a>
cmpq   $0x0,-0x20(%rbp)
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
xor    %eax,%eax
cmpq   $0x0,-0x20(%rbp)
mov    %al,-0x22(%rbp)
je     117d <testAnd+0x6d>
cmpq   $0x0,-0x18(%rbp)
setne  %al
mov    %al,-0x22(%rbp)
mov    -0x22(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
xor    %eax,%eax
cmpq   $0x0,-0x20(%rbp)
mov    %al,-0x23(%rbp)
je     11b0 <testAnd+0xa0>
cmpq   $0x0,-0x10(%rbp)
setne  %al
mov    %al,-0x23(%rbp)
mov    -0x23(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testAnd>:
push   %rbx
mov    %rsi,%rbx
mov    $0x1,%edi
call   1030 <clang_analyzer_eval@plt>
mov    $0x1,%edi
call   1030 <clang_analyzer_eval@plt>
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
pop    %rbx
jmp    1030 <clang_analyzer_eval@plt>

LLVM IR (-O0):
define void @testAnd(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
store i32* null, i32** %5
store i32* %3, i32** %6
%7 = load i32*, i32** %6
%8 = icmp ne i32* %7, null
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i32*, i32** %6
%11 = icmp ne i32* %10, null
br label %12
12: ; preds = %9, %2
%13 = phi i1 [ false, %2 ], [ %11, %9 ]
%14 = zext i1 %13 to i32
%15 = icmp eq i32 %14, 1
%16 = zext i1 %15 to i32
%17 = call i32 @clang_analyzer_eval(i32 %16)
%18 = load i32*, i32** %6
%19 = icmp ne i32* %18, null
br i1 %19, label %20, label %23
20: ; preds = %12
%21 = load i32*, i32** %5
%22 = icmp ne i32* %21, null
br label %23
23: ; preds = %20, %12
%24 = phi i1 [ false, %12 ], [ %22, %20 ]
%25 = zext i1 %24 to i32
%26 = icmp eq i32 %25, 0
%27 = zext i1 %26 to i32
%28 = call i32 @clang_analyzer_eval(i32 %27)
%29 = load i32*, i32** %6
%30 = icmp ne i32* %29, null
br i1 %30, label %31, label %34
31: ; preds = %23
%32 = load i32*, i32** %4
%33 = icmp ne i32* %32, null
br label %34
34: ; preds = %31, %23
%35 = phi i1 [ false, %23 ], [ %33, %31 ]
%36 = zext i1 %35 to i32
%37 = icmp eq i32 %36, 1
%38 = zext i1 %37 to i32
%39 = call i32 @clang_analyzer_eval(i32 %38)
ret void
}

LLVM IR (-O2):
define void @testAnd(i32 %0, i32* readnone %1) {
%3 = tail call i32 @clang_analyzer_eval(i32 1)
%4 = tail call i32 @clang_analyzer_eval(i32 1)
%5 = icmp ne i32* %1, null
%6 = zext i1 %5 to i32
%7 = tail call i32 @clang_analyzer_eval(i32 %6)
ret void
}