#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 main(void) {
  int a[40];
  int n = 30;
  int m = 20;
  int b[n];
  b[29] = 5;
  assert(b[29] = 5);
  int c[n + 4];
  c[31] = 2;
  assert(c[31] = 2);
  int d[n][30];
  d[2][2] = 42;
  assert(d[2][2] == 42);
  int e[20][n];
  e[2][2] = 42;
  assert(e[2][2] == 42);
  int f[m][n];
  f[2][2] = 42;
  assert(f[2][2] == 42);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x1e,-0xa4(%rbp)
movl   $0x14,-0xa8(%rbp)
mov    -0xa4(%rbp),%eax
mov    %eax,%esi
mov    %rsp,%rax
mov    %rax,-0xb0(%rbp)
lea    0xf(,%rsi,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rax
mov    %rax,%rdx
sub    %rcx,%rdx
mov    %rdx,%rsp
mov    %rsi,-0xb8(%rbp)
neg    %rcx
movl   $0x5,0x74(%rdx)
movl   $0x5,0x74(%rax,%rcx,1)
mov    $0x5,%edi
call   1030 <assert@plt>
mov    -0xa4(%rbp),%eax
add    $0x4,%eax
mov    %eax,%esi
lea    0xf(,%rsi,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rax
mov    %rax,%rdx
sub    %rcx,%rdx
mov    %rdx,%rsp
mov    %rsi,-0xc0(%rbp)
neg    %rcx
movl   $0x2,0x7c(%rdx)
movl   $0x2,0x7c(%rax,%rcx,1)
mov    $0x2,%edi
call   1030 <assert@plt>
mov    -0xa4(%rbp),%eax
mov    %eax,%esi
imul   $0x78,%rsi,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rax
mov    %rax,%rdx
sub    %rcx,%rdx
mov    %rdx,%rsp
mov    %rsi,-0xc8(%rbp)
neg    %rcx
movl   $0x2a,0xf8(%rdx)
mov    0xf8(%rax,%rcx,1),%eax
sub    $0x2a,%eax
sete   %al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0xa4(%rbp),%eax
mov    %eax,%ecx
mov    %rcx,%rax
shl    $0x4,%rax
lea    (%rax,%rax,4),%rdx
mov    %rsp,%rax
sub    %rdx,%rax
mov    %rax,%rsp
mov    %rcx,-0xd0(%rbp)
movl   $0x2a,0x8(%rax,%rcx,8)
mov    0x8(%rax,%rcx,8),%eax
sub    $0x2a,%eax
sete   %al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0xa8(%rbp),%eax
mov    %eax,%edx
mov    -0xa4(%rbp),%eax
mov    %eax,%ecx
mov    %rdx,%rax
imul   %rcx,%rax
lea    0xf(,%rax,4),%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rax
sub    %rsi,%rax
mov    %rax,%rsp
mov    %rdx,-0xd8(%rbp)
mov    %rcx,-0xe0(%rbp)
mov    %rcx,%rdx
shl    $0x1,%rdx
movl   $0x2a,0x8(%rax,%rdx,4)
shl    $0x1,%rcx
cmpl   $0x2a,0x8(%rax,%rcx,4)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0xb0(%rbp),%rax
mov    %rax,%rsp
xor    %eax,%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x5,%edi
call   1030 <assert@plt>
mov    $0x2,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca [40 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
store i32 30, i32* %2
store i32 20, i32* %3
%11 = load i32, i32* %2
%12 = zext i32 %11 to i64
%13 = call i8* @llvm.stacksave()
store i8* %13, i8** %4
%14 = alloca i32, i64 %12
store i64 %12, i64* %5
%15 = getelementptr inbounds i32, i32* %14, i64 29
store i32 5, i32* %15
%16 = getelementptr inbounds i32, i32* %14, i64 29
store i32 5, i32* %16
%17 = call i32 @assert(i32 5)
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 4
%20 = zext i32 %19 to i64
%21 = alloca i32, i64 %20
store i64 %20, i64* %6
%22 = getelementptr inbounds i32, i32* %21, i64 31
store i32 2, i32* %22
%23 = getelementptr inbounds i32, i32* %21, i64 31
store i32 2, i32* %23
%24 = call i32 @assert(i32 2)
%25 = load i32, i32* %2
%26 = zext i32 %25 to i64
%27 = alloca [30 x i32], i64 %26
store i64 %26, i64* %7
%28 = getelementptr inbounds [30 x i32], [30 x i32]* %27, i64 2
%29 = getelementptr inbounds [30 x i32], [30 x i32]* %28, i64 0, i64 2
store i32 42, i32* %29
%30 = getelementptr inbounds [30 x i32], [30 x i32]* %27, i64 2
%31 = getelementptr inbounds [30 x i32], [30 x i32]* %30, i64 0, i64 2
%32 = load i32, i32* %31
%33 = icmp eq i32 %32, 42
%34 = zext i1 %33 to i32
%35 = call i32 @assert(i32 %34)
%36 = load i32, i32* %2
%37 = zext i32 %36 to i64
%38 = mul nuw i64 20, %37
%39 = alloca i32, i64 %38
store i64 %37, i64* %8
%40 = mul nsw i64 2, %37
%41 = getelementptr inbounds i32, i32* %39, i64 %40
%42 = getelementptr inbounds i32, i32* %41, i64 2
store i32 42, i32* %42
%43 = mul nsw i64 2, %37
%44 = getelementptr inbounds i32, i32* %39, i64 %43
%45 = getelementptr inbounds i32, i32* %44, i64 2
%46 = load i32, i32* %45
%47 = icmp eq i32 %46, 42
%48 = zext i1 %47 to i32
%49 = call i32 @assert(i32 %48)
%50 = load i32, i32* %3
%51 = zext i32 %50 to i64
%52 = load i32, i32* %2
%53 = zext i32 %52 to i64
%54 = mul nuw i64 %51, %53
%55 = alloca i32, i64 %54
store i64 %51, i64* %9
store i64 %53, i64* %10
%56 = mul nsw i64 2, %53
%57 = getelementptr inbounds i32, i32* %55, i64 %56
%58 = getelementptr inbounds i32, i32* %57, i64 2
store i32 42, i32* %58
%59 = mul nsw i64 2, %53
%60 = getelementptr inbounds i32, i32* %55, i64 %59
%61 = getelementptr inbounds i32, i32* %60, i64 2
%62 = load i32, i32* %61
%63 = icmp eq i32 %62, 42
%64 = zext i1 %63 to i32
%65 = call i32 @assert(i32 %64)
%66 = load i8*, i8** %4
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 5)
%2 = tail call i32 @assert(i32 2)
%3 = tail call i32 @assert(i32 1)
%4 = tail call i32 @assert(i32 1)
%5 = tail call i32 @assert(i32 1)
ret i32 0
}