#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);
int /*<<< orphan*/ printf(char *, int);
void example8(void) {
  int a[42][42];
  for (int i = 0; i < 42; i++) {
    for (int j = 0; j < 42; j++) {
      a[i][j] = 0;
    }
  }
  a[14][0] = 3;
  int *ptr = a[7];
  int x = *(ptr + 7);
  assert(x == 3);
  int(*ptr2)[42];
  ptr2 = a + 7;
  x = (*ptr2)[6];
  assert(x == 3);
  printf("x is %d\n", x);
}


x86 assembly (clang, -O0):
<example8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1bb0,%rsp
movl   $0x0,-0x1b94(%rbp)
cmpl   $0x2a,-0x1b94(%rbp)
jge    11ac <example8+0x8c>
movl   $0x0,-0x1b98(%rbp)
cmpl   $0x2a,-0x1b98(%rbp)
jge    1193 <example8+0x73>
movslq -0x1b94(%rbp),%rcx
lea    -0x1b90(%rbp),%rax
imul   $0xa8,%rcx,%rcx
add    %rcx,%rax
movslq -0x1b98(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x1b98(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b98(%rbp)
jmp    114c <example8+0x2c>
jmp    1198 <example8+0x78>
mov    -0x1b94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b94(%rbp)
jmp    1135 <example8+0x15>
movl   $0x3,-0x1260(%rbp)
lea    -0x1b90(%rbp),%rax
add    $0x498,%rax
mov    %rax,-0x1ba0(%rbp)
mov    -0x1ba0(%rbp),%rax
mov    0x1c(%rax),%eax
mov    %eax,-0x1ba4(%rbp)
cmpl   $0x3,-0x1ba4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    -0x1b90(%rbp),%rax
add    $0x498,%rax
mov    %rax,-0x1bb0(%rbp)
mov    -0x1bb0(%rbp),%rax
mov    0x18(%rax),%eax
mov    %eax,-0x1ba4(%rbp)
cmpl   $0x3,-0x1ba4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x1ba4(%rbp),%esi
lea    0xdcd(%rip),%rdi
call   1030 <printf@plt>
add    $0x1bb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<example8>:
push   %rax
xor    %edi,%edi
call   1040 <assert@plt>
xor    %edi,%edi
call   1040 <assert@plt>
lea    0xeca(%rip),%rdi
xor    %esi,%esi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"x is %d\0A\00"
define void @example8() {
%1 = alloca [42 x [42 x i32]]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca [42 x i32]*
store i32 0, i32* %2
br label %7
7: ; preds = %25, %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 42
br i1 %9, label %10, label %28
10: ; preds = %7
store i32 0, i32* %3
br label %11
11: ; preds = %21, %10
%12 = load i32, i32* %3
%13 = icmp slt i32 %12, 42
br i1 %13, label %14, label %24
14: ; preds = %11
%15 = load i32, i32* %2
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [42 x [42 x i32]], [42 x [42 x i32]]* %1, i64 0, i64 %16
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [42 x i32], [42 x i32]* %17, i64 0, i64 %19
store i32 0, i32* %20
br label %21
21: ; preds = %14
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %11
24: ; preds = %11
br label %25
25: ; preds = %24
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 1
store i32 %27, i32* %2
br label %7
28: ; preds = %7
%29 = getelementptr inbounds [42 x [42 x i32]], [42 x [42 x i32]]* %1, i64 0, i64 14
%30 = getelementptr inbounds [42 x i32], [42 x i32]* %29, i64 0, i64 0
store i32 3, i32* %30
%31 = getelementptr inbounds [42 x [42 x i32]], [42 x [42 x i32]]* %1, i64 0, i64 7
%32 = getelementptr inbounds [42 x i32], [42 x i32]* %31, i64 0, i64 0
store i32* %32, i32** %4
%33 = load i32*, i32** %4
%34 = getelementptr inbounds i32, i32* %33, i64 7
%35 = load i32, i32* %34
store i32 %35, i32* %5
%36 = load i32, i32* %5
%37 = icmp eq i32 %36, 3
%38 = zext i1 %37 to i32
%39 = call i32 @assert(i32 %38)
%40 = getelementptr inbounds [42 x [42 x i32]], [42 x [42 x i32]]* %1, i64 0, i64 0
%41 = getelementptr inbounds [42 x i32], [42 x i32]* %40, i64 7
store [42 x i32]* %41, [42 x i32]** %6
%42 = load [42 x i32]*, [42 x i32]** %6
%43 = getelementptr inbounds [42 x i32], [42 x i32]* %42, i64 0, i64 6
%44 = load i32, i32* %43
store i32 %44, i32* %5
%45 = load i32, i32* %5
%46 = icmp eq i32 %45, 3
%47 = zext i1 %46 to i32
%48 = call i32 @assert(i32 %47)
%49 = load i32, i32* %5
%50 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %49)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"x is %d\0A\00"
define void @example8() {
%1 = tail call i32 @assert(i32 0)
%2 = tail call i32 @assert(i32 0)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 0)
ret void
}