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

LLVM IR (-O2):
define void @foo3(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
}