#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int matrix[3][4] = {{1, 2, 3, 4}, {11, 12, 13, 14}, {21, 22, 23, 24}};
  printf("%p\n", (void *)*(matrix + 0));
  printf("%p\n", (void *)matrix);
  printf("%p\n", (void *)&matrix[0][0]);
  *(*(matrix + 0) + 1) = 98;
  *(*(matrix + 1) + 2) = 99;
  *(*(matrix + 2) + 3) = 100;
  for (int i = 0; i < 3; i++)
    for (int j = 0; j < 4; j++)
      printf("%d, ", *(*(matrix + i) + j));
  printf("\nsudirripts/indirection together\nelem: %d\n", *(matrix[2] + 1));
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xec6(%rip),%rsi
mov    $0x30,%edx
call   1040 <memcpy@plt>
lea    -0x40(%rbp),%rax
mov    %eax,%esi
lea    0xedf(%rip),%rdi
call   1030 <printf@plt>
lea    -0x40(%rbp),%rax
mov    %eax,%esi
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
lea    -0x40(%rbp),%rax
mov    %eax,%esi
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
movl   $0x62,-0x3c(%rbp)
movl   $0x63,-0x28(%rbp)
movl   $0x64,-0x14(%rbp)
movl   $0x0,-0x44(%rbp)
cmpl   $0x3,-0x44(%rbp)
jge    11f4 <main+0xd4>
movl   $0x0,-0x48(%rbp)
cmpl   $0x4,-0x48(%rbp)
jge    11e1 <main+0xc1>
lea    -0x40(%rbp),%rax
movslq -0x44(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x48(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe66(%rip),%rdi
call   1030 <printf@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    11a7 <main+0x87>
jmp    11e6 <main+0xc6>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1196 <main+0x76>
mov    -0x1c(%rbp),%esi
lea    0xe3b(%rip),%rdi
call   1030 <printf@plt>
mov    0x2dd6(%rip),%rax
mov    (%rax),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
movaps 0xf02(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xee6(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeca(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%r14
lea    0xeec(%rip),%rbx
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <printf@plt>
movl   $0x62,0x4(%rsp)
movl   $0x63,0x18(%rsp)
movl   $0x64,0x2c(%rsp)
mov    (%rsp),%esi
lea    0xead(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x24(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x28(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x2c(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x24(%rsp),%esi
lea    0xe1b(%rip),%rdi
call   1030 <printf@plt>
mov    0x2db6(%rip),%rax
mov    (%rax),%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.matrix = [3 x [4 x i32]] [[4 x i32] [i32 1, i32 2, i32 3, i32 4], [4 x i32] [i32 11, i32 12, i32 13, i32 14], [4 x i32] [i32 21, i32 22, i32 23, i32 24]]
@.str = [4 x i8] c"%p\0A\00"
@.str.1 = [5 x i8] c"%d, \00"
@.str.2 = [43 x i8] c"\0Asudirripts/indirection together\0Aelem: %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x [4 x i32]]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [3 x [4 x i32]]* %2 to i8*
%6 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %2, i64 0, i64 0
%7 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0
%8 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 0
%9 = bitcast i32* %8 to i8*
%10 = ptrtoint i8* %9 to i32
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %2, i64 0, i64 0
%13 = bitcast [4 x i32]* %12 to i8*
%14 = ptrtoint i8* %13 to i32
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %2, i64 0, i64 0
%17 = getelementptr inbounds [4 x i32], [4 x i32]* %16, i64 0, i64 0
%18 = bitcast i32* %17 to i8*
%19 = ptrtoint i8* %18 to i32
%20 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %2, i64 0, i64 0
%22 = getelementptr inbounds [4 x i32], [4 x i32]* %21, i64 0
%23 = getelementptr inbounds [4 x i32], [4 x i32]* %22, i64 0, i64 0
%24 = getelementptr inbounds i32, i32* %23, i64 1
store i32 98, i32* %24
%25 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %2, i64 0, i64 0
%26 = getelementptr inbounds [4 x i32], [4 x i32]* %25, i64 1
%27 = getelementptr inbounds [4 x i32], [4 x i32]* %26, i64 0, i64 0
%28 = getelementptr inbounds i32, i32* %27, i64 2
store i32 99, i32* %28
%29 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %2, i64 0, i64 0
%30 = getelementptr inbounds [4 x i32], [4 x i32]* %29, i64 2
%31 = getelementptr inbounds [4 x i32], [4 x i32]* %30, i64 0, i64 0
%32 = getelementptr inbounds i32, i32* %31, i64 3
store i32 100, i32* %32
store i32 0, i32* %3
br label %33
33: ; preds = %55, %0
%34 = load i32, i32* %3
%35 = icmp slt i32 %34, 3
br i1 %35, label %36, label %58
36: ; preds = %33
store i32 0, i32* %4
br label %37
37: ; preds = %51, %36
%38 = load i32, i32* %4
%39 = icmp slt i32 %38, 4
br i1 %39, label %40, label %54
40: ; preds = %37
%41 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %2, i64 0, i64 0
%42 = load i32, i32* %3
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [4 x i32], [4 x i32]* %41, i64 %43
%45 = getelementptr inbounds [4 x i32], [4 x i32]* %44, i64 0, i64 0
%46 = load i32, i32* %4
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i32, i32* %45, i64 %47
%49 = load i32, i32* %48
%50 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %49)
br label %51
51: ; preds = %40
%52 = load i32, i32* %4
%53 = add nsw i32 %52, 1
store i32 %53, i32* %4
br label %37
54: ; preds = %37
br label %55
55: ; preds = %54
%56 = load i32, i32* %3
%57 = add nsw i32 %56, 1
store i32 %57, i32* %3
br label %33
58: ; preds = %33
%59 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %2, i64 0, i64 2
%60 = getelementptr inbounds [4 x i32], [4 x i32]* %59, i64 0, i64 0
%61 = getelementptr inbounds i32, i32* %60, i64 1
%62 = load i32, i32* %61
%63 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i32 %62)
%64 = load i32, i32* @EXIT_SUCCESS
ret i32 %64
}

LLVM IR (-O2):
@__const.main.matrix = [3 x [4 x i32]] [[4 x i32] [i32 1, i32 2, i32 3, i32 4], [4 x i32] [i32 11, i32 12, i32 13, i32 14], [4 x i32] [i32 21, i32 22, i32 23, i32 24]]
@.str = [4 x i8] c"%p\0A\00"
@.str.1 = [5 x i8] c"%d, \00"
@.str.2 = [43 x i8] c"\0Asudirripts/indirection together\0Aelem: %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [3 x [4 x i32]]
%2 = bitcast [3 x [4 x i32]]* %1 to i8*
%3 = ptrtoint [3 x [4 x i32]]* %1 to i64
%4 = trunc i64 %3 to i32
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%8 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %1, i64 0, i64 0, i64 1
store i32 98, i32* %8
%9 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %1, i64 0, i64 1, i64 2
store i32 99, i32* %9
%10 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %1, i64 0, i64 2, i64 3
store i32 100, i32* %10
%11 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %1, i64 0, i64 0, i64 0
%12 = load i32, i32* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %8
%15 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %1, i64 0, i64 0, i64 2
%17 = load i32, i32* %16
%18 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %1, i64 0, i64 0, i64 3
%20 = load i32, i32* %19
%21 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %1, i64 0, i64 1, i64 0
%23 = load i32, i32* %22
%24 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %23)
%25 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %1, i64 0, i64 1, i64 1
%26 = load i32, i32* %25
%27 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %9
%29 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %28)
%30 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %1, i64 0, i64 1, i64 3
%31 = load i32, i32* %30
%32 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %31)
%33 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %1, i64 0, i64 2, i64 0
%34 = load i32, i32* %33
%35 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %34)
%36 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %1, i64 0, i64 2, i64 1
%37 = load i32, i32* %36
%38 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %37)
%39 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %1, i64 0, i64 2, i64 2
%40 = load i32, i32* %39
%41 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %40)
%42 = load i32, i32* %10
%43 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %42)
%44 = load i32, i32* %36
%45 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i32 %44)
%46 = load i32, i32* @EXIT_SUCCESS
ret i32 %46
}