#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);
void example2(void) {
  for (int i = 0; i < 47; i++) {
    int a[i + 2];
    for (int j = 0; j < 2; j++) {
      a[j] = 0;
    }
    assert(a[0] == 0);
  }
}


x86 assembly (clang, -O0):
<example2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x2f,-0x4(%rbp)
jge    11aa <example2+0x9a>
mov    -0x4(%rbp),%eax
add    $0x2,%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x2,-0x1c(%rbp)
jge    1181 <example2+0x71>
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    115a <example2+0x4a>
mov    -0x28(%rbp),%rax
cmpl   $0x0,(%rax)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <example2+0xf>
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<example2>:
push   %r14
push   %rbx
push   %rax
mov    $0x2f,%ebx
nopl   0x0(%rax)
mov    %rsp,%r14
mov    $0x1,%edi
call   1030 <assert@plt>
mov    %r14,%rsp
add    $0xffffffffffffffff,%rbx
jne    1120 <example2+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @example2() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i32
store i32 0, i32* %1
br label %5
5: ; preds = %31, %0
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 47
br i1 %7, label %8, label %34
8: ; preds = %5
%9 = load i32, i32* %1
%10 = add nsw i32 %9, 2
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %2
%13 = alloca i32, i64 %11
store i64 %11, i64* %3
store i32 0, i32* %4
br label %14
14: ; preds = %21, %8
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 2
br i1 %16, label %17, label %24
17: ; preds = %14
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %13, i64 %19
store i32 0, i32* %20
br label %21
21: ; preds = %17
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %14
24: ; preds = %14
%25 = getelementptr inbounds i32, i32* %13, i64 0
%26 = load i32, i32* %25
%27 = icmp eq i32 %26, 0
%28 = zext i1 %27 to i32
%29 = call i32 @assert(i32 %28)
%30 = load i8*, i8** %2
br label %31
31: ; preds = %24
%32 = load i32, i32* %1
%33 = add nsw i32 %32, 1
store i32 %33, i32* %1
br label %5
34: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @example2() {
br label %2
1: ; preds = %2
ret void
2: ; preds = %0, %2
%3 = phi i64 [ 0, %0 ], [ %6, %2 ]
%4 = tail call i8* @llvm.stacksave()
%5 = tail call i32 @assert(i32 1)
tail call void @llvm.stackrestore(i8* %4)
%6 = add nuw nsw i64 %3, 1
%7 = icmp eq i64 %6, 47
br i1 %7, label %1, label %2
}