#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*/ exit(int);
int /*<<< orphan*/ printf(char *, int, ...);
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 *p = a;
  p++;
  if (sizeof(a) != sizeof(p)) {
    printf("Error %d\n", (int)2);
    exit(2);
  };
  if (sizeof(b) != (n * sizeof(double))) {
    printf("Error %d\n", (int)3);
    exit(3);
  };
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%edx
mov    %rdx,-0x30(%rbp)
mov    %rsp,%rax
mov    %rax,-0x18(%rbp)
lea    0xf(,%rdx,8),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rax
sub    %rcx,%rax
mov    %rax,%rsp
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x4(%rbp),%esi
sub    $0x1,%esi
movslq %esi,%rsi
movl   $0x0,(%rcx,%rsi,4)
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
shl    $0x3,%rdx
lea    0xe78(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %rcx,-0x28(%rbp)
mov    -0x28(%rbp),%rcx
add    $0x4,%rcx
mov    %rcx,-0x28(%rbp)
shl    $0x3,%rax
movslq -0x4(%rbp),%rcx
shl    $0x3,%rcx
cmp    %rcx,%rax
je     11de <foo+0xbe>
lea    0xe58(%rip),%rdi
mov    $0x3,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x3,%edi
call   1040 <exit@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    0xec3(%rip),%rdi
mov    $0x8,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
shl    $0x3,%rbx
cmp    %rbx,%r14
jne    115d <foo+0x3d>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xebc(%rip),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x3,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"sizeof(a) = %d, sizeof(b) = %d\0A\00"
@.str.1 = [10 x i8] c"Error %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*
store i32 %0, i32* %3
store i32* %1, i32** %4
%8 = load i32, i32* %3
%9 = zext i32 %8 to i64
%10 = load i32, i32* %3
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %5
%13 = alloca double, i64 %11
store i64 %11, i64* %6
%14 = load i32*, i32** %4
%15 = load i32, i32* %3
%16 = sub nsw i32 %15, 1
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i32, i32* %14, i64 %17
store i32 0, i32* %18
%19 = load i32, i32* %3
%20 = sub nsw i32 %19, 1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds double, double* %13, i64 %21
store double 0.000000e+00, double* %22
%23 = mul nuw i64 8, %11
%24 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 8, i64 %23)
%25 = load i32*, i32** %4
store i32* %25, i32** %7
%26 = load i32*, i32** %7
%27 = getelementptr inbounds i32, i32* %26, i32 1
store i32* %27, i32** %7
%28 = mul nuw i64 8, %11
%29 = load i32, i32* %3
%30 = sext i32 %29 to i64
%31 = mul i64 %30, 8
%32 = icmp ne i64 %28, %31
br i1 %32, label %33, label %36
33: ; preds = %2
%34 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 3)
%35 = call i32 @exit(i32 3)
unreachable
36: ; preds = %2
%37 = load i8*, i8** %5
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"sizeof(a) = %d, sizeof(b) = %d\0A\00"
@.str.1 = [10 x i8] c"Error %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 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 8, i64 %7)
%9 = sext i32 %0 to i64
%10 = shl nsw i64 %9, 3
%11 = icmp eq i64 %7, %10
br i1 %11, label %15, label %12
12: ; preds = %2
%13 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 3)
%14 = tail call i32 @exit(i32 3)
unreachable
15: ; preds = %2
ret void
}