#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*/ abort();
int /*<<< orphan*/ fill(int, short *);
int /*<<< orphan*/ q();
int f(int n, int vla[g()][h()]) {
  short lvla[n + q()];
  vla[1][2] = 7;
  int sz = sizeof lvla;
  if (sz != sizeof(short) * 10)
    abort();
  fill(sz / sizeof *lvla, lvla);
  return lvla[2];
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %al,-0x41(%rbp)
call   1060 <g@plt>
mov    -0x41(%rbp),%al
call   1040 <h@plt>
mov    %eax,%ecx
mov    -0x41(%rbp),%al
mov    %ecx,%ecx
mov    %rcx,-0x40(%rbp)
mov    -0x4(%rbp),%ecx
mov    %ecx,-0x34(%rbp)
call   1070 <q@plt>
mov    -0x40(%rbp),%rdx
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
add    %ecx,%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(%rax,%rax,1),%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rcx
sub    %rsi,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rcx
shl    $0x0,%rdx
movl   $0x7,0x8(%rcx,%rdx,4)
shl    $0x1,%rax
mov    %eax,-0x24(%rbp)
movslq -0x24(%rbp),%rax
cmp    $0x14,%rax
je     11df <f+0x8f>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x30(%rbp),%rsi
movslq -0x24(%rbp),%rax
shr    $0x1,%rax
mov    %eax,%edi
call   1050 <fill@plt>
mov    -0x30(%rbp),%rax
movswl 0x4(%rax),%eax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%ebx
xor    %eax,%eax
call   1060 <g@plt>
xor    %eax,%eax
call   1040 <h@plt>
mov    %eax,%r15d
xor    %eax,%eax
call   1070 <q@plt>
add    %ebx,%eax
lea    (%rax,%rax,1),%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rbx
sub    %rcx,%rbx
mov    %rbx,%rsp
movl   $0x7,0x8(%r14,%r15,4)
and    $0x7fffffff,%eax
cmp    $0xa,%eax
jne    11bd <f+0x6d>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1050 <fill@plt>
movswl 0x4(%rbx),%eax
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @f(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
store i32 %0, i32* %3
store i32* %1, i32** %4
%8 = call i32 (...) @g()
%9 = zext i32 %8 to i64
%10 = call i32 (...) @h()
%11 = zext i32 %10 to i64
%12 = load i32, i32* %3
%13 = call i32 (...) @q()
%14 = add nsw i32 %12, %13
%15 = zext i32 %14 to i64
%16 = call i8* @llvm.stacksave()
store i8* %16, i8** %5
%17 = alloca i16, i64 %15
store i64 %15, i64* %6
%18 = load i32*, i32** %4
%19 = mul nsw i64 1, %11
%20 = getelementptr inbounds i32, i32* %18, i64 %19
%21 = getelementptr inbounds i32, i32* %20, i64 2
store i32 7, i32* %21
%22 = mul nuw i64 2, %15
%23 = trunc i64 %22 to i32
store i32 %23, i32* %7
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = icmp ne i64 %25, 20
br i1 %26, label %27, label %29
27: ; preds = %2
%28 = call i32 (...) @abort()
unreachable
29: ; preds = %2
%30 = load i32, i32* %7
%31 = sext i32 %30 to i64
%32 = udiv i64 %31, 2
%33 = trunc i64 %32 to i32
%34 = call i32 @fill(i32 %33, i16* %17)
%35 = getelementptr inbounds i16, i16* %17, i64 2
%36 = load i16, i16* %35
%37 = sext i16 %36 to i32
%38 = load i8*, i8** %5
ret i32 %37
}

LLVM IR (-O2):
define i32 @f(i32 %0, i32* nocapture writeonly %1) {
%3 = tail call i32 (...) @g()
%4 = tail call i32 (...) @h()
%5 = zext i32 %4 to i64
%6 = tail call i32 (...) @q()
%7 = add nsw i32 %6, %0
%8 = zext i32 %7 to i64
%9 = alloca i16, i64 %8
%10 = getelementptr inbounds i32, i32* %1, i64 %5
%11 = getelementptr inbounds i32, i32* %10, i64 2
store i32 7, i32* %11
%12 = and i32 %7, 2147483647
%13 = icmp eq i32 %12, 10
br i1 %13, label %16, label %14
14: ; preds = %2
%15 = tail call i32 (...) @abort()
unreachable
16: ; preds = %2
%17 = call i32 @fill(i32 10, i16* %9)
%18 = getelementptr inbounds i16, i16* %9, i64 2
%19 = load i16, i16* %18
%20 = sext i16 %19 to i32
ret i32 %20
}