#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 multiDimensionalArrayPointerCasts() {
  static int x[10][10];
  int *y1 = &(x[3][5]);
  char *z = ((char *)y1) + 2;
  int *y2 = (int *)(z - 2);
  int *y3 = ((int *)x) + 35;
  clang_analyzer_eval(y1 == y2);
  clang_analyzer_eval(y1 - y2);
  clang_analyzer_eval(*y1 == *y2);
  clang_analyzer_eval(*((char *)y1) == *((char *)y2));
  clang_analyzer_eval(y1 == y3);
  clang_analyzer_eval(y1 - y3);
  clang_analyzer_eval(*y1 == *y3);
  clang_analyzer_eval(*((char *)y1) == *((char *)y3));
}


x86 assembly (clang, -O0):
<multiDimensionalArrayPointerCasts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0x2f21(%rip),%rax
add    $0x8c,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0xfffffffffffffffe,%rax
mov    %rax,-0x18(%rbp)
lea    0x2ef8(%rip),%rax
add    $0x8c,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x18(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
sar    $0x2,%rax
mov    %eax,%edi
call   1030 <clang_analyzer_eval@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
mov    -0x8(%rbp),%rax
cmp    -0x20(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    %rcx,%rax
sar    $0x2,%rax
mov    %eax,%edi
call   1030 <clang_analyzer_eval@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    -0x20(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<multiDimensionalArrayPointerCasts>:
push   %rax
mov    $0x1,%edi
call   1030 <clang_analyzer_eval@plt>
xor    %edi,%edi
call   1030 <clang_analyzer_eval@plt>
mov    $0x1,%edi
call   1030 <clang_analyzer_eval@plt>
mov    $0x1,%edi
call   1030 <clang_analyzer_eval@plt>
mov    $0x1,%edi
call   1030 <clang_analyzer_eval@plt>
xor    %edi,%edi
call   1030 <clang_analyzer_eval@plt>
mov    $0x1,%edi
call   1030 <clang_analyzer_eval@plt>
mov    $0x1,%edi
pop    %rax
jmp    1030 <clang_analyzer_eval@plt>

LLVM IR (-O0):
@multiDimensionalArrayPointerCasts.x = internal global [10 x [10 x i32]] zeroinitializer
define void @multiDimensionalArrayPointerCasts() {
%1 = alloca i32*
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i32*
store i32* getelementptr inbounds ([10 x [10 x i32]], [10 x [10 x i32]]* @multiDimensionalArrayPointerCasts.x, i64 0, i64 3, i64 5), i32** %1
%5 = load i32*, i32** %1
%6 = bitcast i32* %5 to i8*
%7 = getelementptr inbounds i8, i8* %6, i64 2
store i8* %7, i8** %2
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 -2
%10 = bitcast i8* %9 to i32*
store i32* %10, i32** %3
store i32* getelementptr inbounds ([10 x [10 x i32]], [10 x [10 x i32]]* @multiDimensionalArrayPointerCasts.x, i32 0, i64 3, i64 5), i32** %4
%11 = load i32*, i32** %1
%12 = load i32*, i32** %3
%13 = icmp eq i32* %11, %12
%14 = zext i1 %13 to i32
%15 = call i32 @clang_analyzer_eval(i32 %14)
%16 = load i32*, i32** %1
%17 = load i32*, i32** %3
%18 = ptrtoint i32* %16 to i64
%19 = ptrtoint i32* %17 to i64
%20 = sub i64 %18, %19
%21 = sdiv exact i64 %20, 4
%22 = trunc i64 %21 to i32
%23 = call i32 @clang_analyzer_eval(i32 %22)
%24 = load i32*, i32** %1
%25 = load i32, i32* %24
%26 = load i32*, i32** %3
%27 = load i32, i32* %26
%28 = icmp eq i32 %25, %27
%29 = zext i1 %28 to i32
%30 = call i32 @clang_analyzer_eval(i32 %29)
%31 = load i32*, i32** %1
%32 = bitcast i32* %31 to i8*
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = load i32*, i32** %3
%36 = bitcast i32* %35 to i8*
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %34, %38
%40 = zext i1 %39 to i32
%41 = call i32 @clang_analyzer_eval(i32 %40)
%42 = load i32*, i32** %1
%43 = load i32*, i32** %4
%44 = icmp eq i32* %42, %43
%45 = zext i1 %44 to i32
%46 = call i32 @clang_analyzer_eval(i32 %45)
%47 = load i32*, i32** %1
%48 = load i32*, i32** %4
%49 = ptrtoint i32* %47 to i64
%50 = ptrtoint i32* %48 to i64
%51 = sub i64 %49, %50
%52 = sdiv exact i64 %51, 4
%53 = trunc i64 %52 to i32
%54 = call i32 @clang_analyzer_eval(i32 %53)
%55 = load i32*, i32** %1
%56 = load i32, i32* %55
%57 = load i32*, i32** %4
%58 = load i32, i32* %57
%59 = icmp eq i32 %56, %58
%60 = zext i1 %59 to i32
%61 = call i32 @clang_analyzer_eval(i32 %60)
%62 = load i32*, i32** %1
%63 = bitcast i32* %62 to i8*
%64 = load i8, i8* %63
%65 = sext i8 %64 to i32
%66 = load i32*, i32** %4
%67 = bitcast i32* %66 to i8*
%68 = load i8, i8* %67
%69 = sext i8 %68 to i32
%70 = icmp eq i32 %65, %69
%71 = zext i1 %70 to i32
%72 = call i32 @clang_analyzer_eval(i32 %71)
ret void
}

LLVM IR (-O2):
define void @multiDimensionalArrayPointerCasts() {
%1 = tail call i32 @clang_analyzer_eval(i32 1)
%2 = tail call i32 @clang_analyzer_eval(i32 0)
%3 = tail call i32 @clang_analyzer_eval(i32 1)
%4 = tail call i32 @clang_analyzer_eval(i32 1)
%5 = tail call i32 @clang_analyzer_eval(i32 1)
%6 = tail call i32 @clang_analyzer_eval(i32 0)
%7 = tail call i32 @clang_analyzer_eval(i32 1)
%8 = tail call i32 @clang_analyzer_eval(i32 1)
ret void
}