#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*/ p;
typedef int /*<<< orphan*/ b;
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int /*<<< orphan*/ E(int);
int /*<<< orphan*/ printf(char *, int, int);
int somefunction();
void foo(int n, int a[n]) {
  double b[n];
  a[n - 1] = 0;
  b[n - 1] = 0.0;
  printf("sizeof(a) = %d, sizeof(b) = %d\n", sizeof(a), sizeof(b));
  int m = 78;
  char boom[n][somefunction()];
  char boom2[somefunction()][n];
  char boom3[somefunction()][somefunction()];
  char boom4[somefunction()][17][somefunction()][m];
  int *p = a;
  p++;
  if (sizeof(a) != sizeof(p))
    E(2);
  if (sizeof(b) != (n * sizeof(double)))
    E(3);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x80(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x4(%rbp),%esi
sub    $0x1,%esi
movslq %esi,%rsi
movl   $0x0,(%rdx,%rsi,4)
mov    -0x4(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rcx,%rdx,8)
shl    $0x3,%rax
mov    %eax,%edx
lea    0xe65(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
movl   $0x4e,-0x24(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x98(%rbp)
mov    $0x0,%al
call   1050 <somefunction@plt>
mov    -0x98(%rbp),%rcx
mov    %eax,%eax
mov    %rcx,-0x30(%rbp)
mov    %rax,-0x38(%rbp)
mov    $0x0,%al
call   1050 <somefunction@plt>
mov    %eax,%eax
mov    %eax,%ecx
mov    -0x4(%rbp),%eax
mov    %rcx,-0x40(%rbp)
mov    %rax,-0x48(%rbp)
mov    $0x0,%al
call   1050 <somefunction@plt>
mov    %eax,%eax
mov    %rax,-0x90(%rbp)
mov    $0x0,%al
call   1050 <somefunction@plt>
mov    -0x90(%rbp),%rcx
mov    %eax,%eax
mov    %rcx,-0x50(%rbp)
mov    %rax,-0x58(%rbp)
mov    $0x0,%al
call   1050 <somefunction@plt>
mov    %eax,%eax
mov    %rax,-0x88(%rbp)
mov    $0x0,%al
call   1050 <somefunction@plt>
mov    -0x88(%rbp),%rsi
mov    %eax,%ecx
mov    -0x80(%rbp),%rax
mov    %ecx,%ecx
mov    %ecx,%edx
mov    -0x24(%rbp),%ecx
mov    %rsi,-0x60(%rbp)
mov    %rdx,-0x68(%rbp)
mov    %rcx,-0x70(%rbp)
mov    -0x10(%rbp),%rcx
mov    %rcx,-0x78(%rbp)
mov    -0x78(%rbp),%rcx
add    $0x4,%rcx
mov    %rcx,-0x78(%rbp)
shl    $0x3,%rax
movslq -0x4(%rbp),%rcx
shl    $0x3,%rcx
cmp    %rcx,%rax
je     1276 <foo+0x146>
mov    $0x3,%edi
call   1040 <E@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%r14d
movslq %edi,%rbx
movl   $0x0,-0x4(%rsi,%rbx,4)
shl    $0x3,%r14
lea    0xeb3(%rip),%rdi
mov    $0x8,%esi
mov    %r14d,%edx
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <somefunction@plt>
xor    %eax,%eax
call   1050 <somefunction@plt>
xor    %eax,%eax
call   1050 <somefunction@plt>
xor    %eax,%eax
call   1050 <somefunction@plt>
xor    %eax,%eax
call   1050 <somefunction@plt>
xor    %eax,%eax
call   1050 <somefunction@plt>
shl    $0x3,%rbx
cmp    %rbx,%r14
jne    1195 <foo+0x65>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    $0x3,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <E@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"sizeof(a) = %d, sizeof(b) = %d\0A\00"
define void @foo(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca i64
%16 = alloca i64
%17 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
%18 = load i32, i32* %3
%19 = zext i32 %18 to i64
%20 = load i32, i32* %3
%21 = zext i32 %20 to i64
%22 = call i8* @llvm.stacksave()
store i8* %22, i8** %5
%23 = alloca double, i64 %21
store i64 %21, i64* %6
%24 = load i32*, i32** %4
%25 = load i32, i32* %3
%26 = sub nsw i32 %25, 1
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %24, i64 %27
store i32 0, i32* %28
%29 = load i32, i32* %3
%30 = sub nsw i32 %29, 1
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds double, double* %23, i64 %31
store double 0.000000e+00, double* %32
%33 = mul nuw i64 8, %21
%34 = trunc i64 %33 to i32
%35 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 8, i32 %34)
store i32 78, i32* %7
%36 = load i32, i32* %3
%37 = zext i32 %36 to i64
%38 = call i32 (...) @somefunction()
%39 = zext i32 %38 to i64
%40 = mul nuw i64 %37, %39
%41 = alloca i8, i64 %40
store i64 %37, i64* %8
store i64 %39, i64* %9
%42 = call i32 (...) @somefunction()
%43 = zext i32 %42 to i64
%44 = load i32, i32* %3
%45 = zext i32 %44 to i64
%46 = mul nuw i64 %43, %45
%47 = alloca i8, i64 %46
store i64 %43, i64* %10
store i64 %45, i64* %11
%48 = call i32 (...) @somefunction()
%49 = zext i32 %48 to i64
%50 = call i32 (...) @somefunction()
%51 = zext i32 %50 to i64
%52 = mul nuw i64 %49, %51
%53 = alloca i8, i64 %52
store i64 %49, i64* %12
store i64 %51, i64* %13
%54 = call i32 (...) @somefunction()
%55 = zext i32 %54 to i64
%56 = call i32 (...) @somefunction()
%57 = zext i32 %56 to i64
%58 = load i32, i32* %7
%59 = zext i32 %58 to i64
%60 = mul nuw i64 %55, 17
%61 = mul nuw i64 %60, %57
%62 = mul nuw i64 %61, %59
%63 = alloca i8, i64 %62
store i64 %55, i64* %14
store i64 %57, i64* %15
store i64 %59, i64* %16
%64 = load i32*, i32** %4
store i32* %64, i32** %17
%65 = load i32*, i32** %17
%66 = getelementptr inbounds i32, i32* %65, i32 1
store i32* %66, i32** %17
%67 = mul nuw i64 8, %21
%68 = load i32, i32* %3
%69 = sext i32 %68 to i64
%70 = mul i64 %69, 8
%71 = icmp ne i64 %67, %70
br i1 %71, label %72, label %74
72: ; preds = %2
%73 = call i32 @E(i32 3)
br label %74
74: ; preds = %72, %2
%75 = load i8*, i8** %5
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"sizeof(a) = %d, sizeof(b) = %d\0A\00"
define void @foo(i32 %0, i32* nocapture writeonly %1) {
%3 = zext i32 %0 to i64
%4 = add nsw i32 %0, -1
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i32, i32* %1, i64 %5
store i32 0, i32* %6
%7 = shl nuw nsw i64 %3, 3
%8 = trunc i64 %7 to i32
%9 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 8, i32 %8)
%10 = tail call i32 (...) @somefunction()
%11 = tail call i32 (...) @somefunction()
%12 = tail call i32 (...) @somefunction()
%13 = tail call i32 (...) @somefunction()
%14 = tail call i32 (...) @somefunction()
%15 = tail call i32 (...) @somefunction()
%16 = sext i32 %0 to i64
%17 = shl nsw i64 %16, 3
%18 = icmp eq i64 %7, %17
br i1 %18, label %21, label %19
19: ; preds = %2
%20 = tail call i32 @E(i32 3)
br label %21
21: ; preds = %19, %2
ret void
}