#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*/ fprintf(int /*<<< orphan*/, char *, int **, int, int, int *);
int /*<<< orphan*/ stderr;
void f(int n1, int m1, int v[n1][m1]) {
  fprintf(stderr, "f: %p -> [%d][%d] -> %p\n", v, n1 - 1, m1 - 1,
          &v[n1 - 1][m1 - 1]);
  v[n1 - 1][m1 - 1] = 42;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%esi
mov    %rsi,-0x18(%rbp)
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%r8d
sub    $0x1,%r8d
mov    -0x10(%rbp),%r9
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
cltq
imul   %rsi,%rax
shl    $0x2,%rax
add    %rax,%r9
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cltq
shl    $0x2,%rax
add    %rax,%r9
lea    0xe8d(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
imul   %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movl   $0x2a,(%rax,%rcx,4)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%eax
mov    0x2ec3(%rip),%rcx
mov    (%rcx),%r10d
add    $0xffffffff,%edi
movslq %edi,%rcx
imul   %rcx,%rax
lea    (%rdx,%rax,4),%r14
movslq %esi,%rbx
lea    -0x1(%rsi),%r8d
lea    (%r14,%rbx,4),%r9
add    $0xfffffffffffffffc,%r9
lea    0xebc(%rip),%rsi
mov    %r10d,%edi
call   1030 <fprintf@plt>
movl   $0x2a,-0x4(%r14,%rbx,4)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [25 x i8] c"f: %p -> [%d][%d] -> %p\0A\00"
define void @f(i32 %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%7 = load i32, i32* %4
%8 = zext i32 %7 to i64
%9 = load i32, i32* %5
%10 = zext i32 %9 to i64
%11 = load i32, i32* @stderr
%12 = load i32*, i32** %6
%13 = bitcast i32* %12 to i32**
%14 = load i32, i32* %4
%15 = sub nsw i32 %14, 1
%16 = load i32, i32* %5
%17 = sub nsw i32 %16, 1
%18 = load i32*, i32** %6
%19 = load i32, i32* %4
%20 = sub nsw i32 %19, 1
%21 = sext i32 %20 to i64
%22 = mul nsw i64 %21, %10
%23 = getelementptr inbounds i32, i32* %18, i64 %22
%24 = load i32, i32* %5
%25 = sub nsw i32 %24, 1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %23, i64 %26
%28 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32** %13, i32 %15, i32 %17, i32* %27)
%29 = load i32*, i32** %6
%30 = load i32, i32* %4
%31 = sub nsw i32 %30, 1
%32 = sext i32 %31 to i64
%33 = mul nsw i64 %32, %10
%34 = getelementptr inbounds i32, i32* %29, i64 %33
%35 = load i32, i32* %5
%36 = sub nsw i32 %35, 1
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i32, i32* %34, i64 %37
store i32 42, i32* %38
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [25 x i8] c"f: %p -> [%d][%d] -> %p\0A\00"
define void @f(i32 %0, i32 %1, i32* %2) {
%4 = zext i32 %1 to i64
%5 = load i32, i32* @stderr
%6 = bitcast i32* %2 to i32**
%7 = add nsw i32 %0, -1
%8 = add nsw i32 %1, -1
%9 = sext i32 %7 to i64
%10 = mul nsw i64 %9, %4
%11 = getelementptr inbounds i32, i32* %2, i64 %10
%12 = sext i32 %8 to i64
%13 = getelementptr inbounds i32, i32* %11, i64 %12
%14 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32** %6, i32 %7, i32 %8, i32* %13)
store i32 42, i32* %13
ret void
}