#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*/ assert(int);
void foo4(int n, int a[n][n]) {
  int x = (*(a + 29))[7];
  assert(x == 23);
  int y = (*(a + 7))[13];
  assert(y == 23);
  assert(a[7][13] == 23);
}


x86 assembly (clang, -O0):
<foo4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
imul   $0x1d,%rcx,%rcx
mov    0x1c(%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x17,-0x14(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rax
imul   $0x7,%rcx,%rcx
mov    0x34(%rax,%rcx,4),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x17,-0x18(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rax
imul   $0x7,%rcx,%rcx
cmpl   $0x17,0x34(%rax,%rcx,4)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo4>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%r15d
imul   $0x74,%r15,%rax
xor    %edi,%edi
cmpl   $0x17,0x1c(%rsi,%rax,1)
sete   %dil
call   1030 <assert@plt>
lea    (%r15,%r15,8),%rax
lea    (%rax,%rax,2),%rbx
add    %r15,%rbx
xor    %edi,%edi
cmpl   $0x17,0x34(%r14,%rbx,1)
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x17,0x34(%r14,%rbx,1)
sete   %dil
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <assert@plt>

LLVM IR (-O0):
define void @foo4(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
%7 = load i32, i32* %3
%8 = zext i32 %7 to i64
%9 = load i32, i32* %3
%10 = zext i32 %9 to i64
%11 = load i32*, i32** %4
%12 = mul nsw i64 29, %10
%13 = getelementptr inbounds i32, i32* %11, i64 %12
%14 = getelementptr inbounds i32, i32* %13, i64 7
%15 = load i32, i32* %14
store i32 %15, i32* %5
%16 = load i32, i32* %5
%17 = icmp eq i32 %16, 23
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = load i32*, i32** %4
%21 = mul nsw i64 7, %10
%22 = getelementptr inbounds i32, i32* %20, i64 %21
%23 = getelementptr inbounds i32, i32* %22, i64 13
%24 = load i32, i32* %23
store i32 %24, i32* %6
%25 = load i32, i32* %6
%26 = icmp eq i32 %25, 23
%27 = zext i1 %26 to i32
%28 = call i32 @assert(i32 %27)
%29 = load i32*, i32** %4
%30 = mul nsw i64 7, %10
%31 = getelementptr inbounds i32, i32* %29, i64 %30
%32 = getelementptr inbounds i32, i32* %31, i64 13
%33 = load i32, i32* %32
%34 = icmp eq i32 %33, 23
%35 = zext i1 %34 to i32
%36 = call i32 @assert(i32 %35)
ret void
}

LLVM IR (-O2):
define void @foo4(i32 %0, i32* nocapture %1) {
%3 = zext i32 %0 to i64
%4 = mul nuw nsw i64 %3, 29
%5 = getelementptr inbounds i32, i32* %1, i64 %4
%6 = getelementptr inbounds i32, i32* %5, i64 7
%7 = load i32, i32* %6
%8 = icmp eq i32 %7, 23
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
%11 = mul nuw nsw i64 %3, 7
%12 = getelementptr inbounds i32, i32* %1, i64 %11
%13 = getelementptr inbounds i32, i32* %12, i64 13
%14 = load i32, i32* %13
%15 = icmp eq i32 %14, 23
%16 = zext i1 %15 to i32
%17 = tail call i32 @assert(i32 %16)
%18 = load i32, i32* %13
%19 = icmp eq i32 %18, 23
%20 = zext i1 %19 to i32
%21 = tail call i32 @assert(i32 %20)
ret void
}