#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 randomInt();
int testConcreteInvalidation(int index) {
  int vals[10];
  vals[index] = 42;
  clang_analyzer_eval(vals[index] == 42);
  vals[0] = randomInt();
  clang_analyzer_eval(vals[index] == 42);
  return vals[0];
}


x86 assembly (clang, -O0):
<testConcreteInvalidation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
movl   $0x2a,-0x30(%rbp,%rax,4)
movslq -0x4(%rbp),%rax
cmpl   $0x2a,-0x30(%rbp,%rax,4)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <clang_analyzer_eval@plt>
mov    $0x0,%al
call   1030 <randomInt@plt>
mov    %eax,-0x30(%rbp)
movslq -0x4(%rbp),%rax
cmpl   $0x2a,-0x30(%rbp,%rax,4)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <clang_analyzer_eval@plt>
mov    -0x30(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testConcreteInvalidation>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movslq %edi,%r14
movl   $0x2a,(%rsp,%r14,4)
mov    $0x1,%edi
call   1040 <clang_analyzer_eval@plt>
xor    %eax,%eax
call   1030 <randomInt@plt>
mov    %eax,%ebx
mov    %eax,(%rsp)
xor    %edi,%edi
cmpl   $0x2a,(%rsp,%r14,4)
sete   %dil
call   1040 <clang_analyzer_eval@plt>
mov    %ebx,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @testConcreteInvalidation(i32 %0) {
%2 = alloca i32
%3 = alloca [10 x i32]
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %5
store i32 42, i32* %6
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %8
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, 42
%12 = zext i1 %11 to i32
%13 = call i32 @clang_analyzer_eval(i32 %12)
%14 = call i32 (...) @randomInt()
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
store i32 %14, i32* %15
%16 = load i32, i32* %2
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %17
%19 = load i32, i32* %18
%20 = icmp eq i32 %19, 42
%21 = zext i1 %20 to i32
%22 = call i32 @clang_analyzer_eval(i32 %21)
%23 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%24 = load i32, i32* %23
ret i32 %24
}

LLVM IR (-O2):
define i32 @testConcreteInvalidation(i32 %0) {
%2 = alloca [10 x i32]
%3 = bitcast [10 x i32]* %2 to i8*
%4 = sext i32 %0 to i64
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %4
store i32 42, i32* %5
%6 = tail call i32 @clang_analyzer_eval(i32 1)
%7 = tail call i32 (...) @randomInt()
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
store i32 %7, i32* %8
%9 = load i32, i32* %5
%10 = icmp eq i32 %9, 42
%11 = zext i1 %10 to i32
%12 = tail call i32 @clang_analyzer_eval(i32 %11)
ret i32 %7
}