#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 */
typedef int /*<<< orphan*/ v;

/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ f(int, int, int **);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ memset(int **, int /*<<< orphan*/, int);
int /*<<< orphan*/ stderr;
int g(int n1, int m1) {
  int v[n1][m1];
  memset(v, 0, sizeof(v));
  fprintf(stderr, "g: %p -> [%d][%d] -> %p\n", v, n1 - 1, m1 - 1,
          &v[n1 - 1][m1 - 1]);
  f(n1, m1, v);
#pragma omp taskwait
  if (v[n1 - 1][m1 - 1] != 42) {
    fprintf(stderr, "%d != 42\n", v[n1 - 1][m1 - 1]);
    abort();
  }
}


x86 assembly (clang, -O0):
<g>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
mov    %rcx,-0x38(%rbp)
mov    %rsp,%rdx
mov    %rdx,-0x18(%rbp)
mov    %rax,%rdx
imul   %rcx,%rdx
lea    0xf(,%rdx,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rdi
sub    %rdx,%rdi
mov    %rdi,-0x30(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
imul   %rcx,%rax
shl    $0x2,%rax
mov    %eax,%edx
xor    %esi,%esi
call   1050 <memset@plt>
mov    -0x38(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
mov    -0xc(%rbp),%r8d
sub    $0x1,%r8d
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cltq
imul   %rsi,%rax
shl    $0x2,%rax
mov    %rdx,%r9
add    %rax,%r9
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
cltq
shl    $0x2,%rax
add    %rax,%r9
lea    0xe1d(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x30(%rbp),%rdx
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <f@plt>
mov    -0x38(%rbp),%rdx
mov    -0x30(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
imul   %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
cmpl   $0x2a,(%rax,%rcx,4)
je     126e <g+0x12e>
mov    -0x30(%rbp),%rax
mov    -0x38(%rbp),%rdx
mov    0x2da9(%rip),%rcx
mov    (%rcx),%edi
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
imul   %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
lea    0xdb9(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %edi,%r14d
mov    %edi,%edx
mov    %esi,%r12d
imul   %r12,%rdx
lea    0xf(,%rdx,4),%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
shl    $0x2,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
lea    -0x1(%r14),%eax
movslq %eax,%rcx
imul   %rcx,%r12
lea    (%rbx,%r12,4),%r13
movslq %r15d,%r12
add    $0xffffffff,%r15d
lea    -0x4(,%r12,4),%r9
ff
add    %r13,%r9
lea    0xe50(%rip),%rsi
mov    %rbx,%rdx
mov    %r15d,%r8d
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    %r14d,%edi
mov    %r12d,%esi
mov    %rbx,%rdx
call   1040 <f@plt>
mov    -0x4(%r13,%r12,4),%edx
cmp    $0x2a,%edx
jne    11e4 <g+0xa4>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2df5(%rip),%rax
mov    (%rax),%edi
lea    0xe25(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [25 x i8] c"g: %p -> [%d][%d] -> %p\0A\00"
@.str.1 = [10 x i8] c"%d != 42\0A\00"
define i32 @g(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
store i32 %0, i32* %4
store i32 %1, i32* %5
%9 = load i32, i32* %4
%10 = zext i32 %9 to i64
%11 = load i32, i32* %5
%12 = zext i32 %11 to i64
%13 = call i8* @llvm.stacksave()
store i8* %13, i8** %6
%14 = mul nuw i64 %10, %12
%15 = alloca i32, i64 %14
store i64 %10, i64* %7
store i64 %12, i64* %8
%16 = bitcast i32* %15 to i32**
%17 = mul nuw i64 %10, %12
%18 = mul nuw i64 4, %17
%19 = trunc i64 %18 to i32
%20 = call i32 @memset(i32** %16, i32 0, i32 %19)
%21 = load i32, i32* @stderr
%22 = load i32, i32* %4
%23 = sub nsw i32 %22, 1
%24 = load i32, i32* %5
%25 = sub nsw i32 %24, 1
%26 = load i32, i32* %4
%27 = sub nsw i32 %26, 1
%28 = sext i32 %27 to i64
%29 = mul nsw i64 %28, %12
%30 = getelementptr inbounds i32, i32* %15, i64 %29
%31 = load i32, i32* %5
%32 = sub nsw i32 %31, 1
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32, i32* %30, i64 %33
%35 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32* %15, i32 %23, i32 %25, i32* %34)
%36 = load i32, i32* %4
%37 = load i32, i32* %5
%38 = bitcast i32* %15 to i32**
%39 = call i32 @f(i32 %36, i32 %37, i32** %38)
%40 = load i32, i32* %4
%41 = sub nsw i32 %40, 1
%42 = sext i32 %41 to i64
%43 = mul nsw i64 %42, %12
%44 = getelementptr inbounds i32, i32* %15, i64 %43
%45 = load i32, i32* %5
%46 = sub nsw i32 %45, 1
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i32, i32* %44, i64 %47
%49 = load i32, i32* %48
%50 = icmp ne i32 %49, 42
br i1 %50, label %51, label %65
51: ; preds = %2
%52 = load i32, i32* @stderr
%53 = load i32, i32* %4
%54 = sub nsw i32 %53, 1
%55 = sext i32 %54 to i64
%56 = mul nsw i64 %55, %12
%57 = getelementptr inbounds i32, i32* %15, i64 %56
%58 = load i32, i32* %5
%59 = sub nsw i32 %58, 1
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i32, i32* %57, i64 %60
%62 = load i32, i32* %61
%63 = call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %62)
%64 = call i32 (...) @abort()
unreachable
65: ; preds = %2
%66 = load i8*, i8** %6
%67 = load i32, i32* %3
ret i32 %67
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [25 x i8] c"g: %p -> [%d][%d] -> %p\0A\00"
@.str.1 = [10 x i8] c"%d != 42\0A\00"
define i32 @g(i32 %0, i32 %1) {
%3 = zext i32 %0 to i64
%4 = zext i32 %1 to i64
%5 = mul nuw i64 %4, %3
%6 = alloca i32, i64 %5
%7 = bitcast i32* %6 to i32**
%8 = trunc i64 %5 to i32
%9 = shl i32 %8, 2
%10 = call i32 @memset(i32** %7, i32 0, i32 %9)
%11 = load i32, i32* @stderr
%12 = add nsw i32 %0, -1
%13 = add nsw i32 %1, -1
%14 = sext i32 %12 to i64
%15 = mul nsw i64 %14, %4
%16 = getelementptr inbounds i32, i32* %6, i64 %15
%17 = sext i32 %13 to i64
%18 = getelementptr inbounds i32, i32* %16, i64 %17
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32* %6, i32 %12, i32 %13, i32* %18)
%20 = call i32 @f(i32 %0, i32 %1, i32** %7)
%21 = load i32, i32* %18
%22 = icmp eq i32 %21, 42
br i1 %22, label %27, label %23
23: ; preds = %2
%24 = load i32, i32* @stderr
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%26 = call i32 (...) @abort()
unreachable
27: ; preds = %2
ret i32 undef
}