#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*/ bar(int, char *, char *, char *, char *, int);
void foo(int size) {
  int i;
  for (i = 0; i < size; i++) {
    char temp[size];
    temp[size - 1] = '\0';
    {
      char temp2[size];
      {
        char temp3[size];
        {
          char temp4[size];
          bar(i, temp, temp2, temp3, temp4, size);
        }
      }
    }
  }
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11f8 <foo+0xe8>
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,%rsp
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
cltq
movb   $0x0,(%rax,%rsi,1)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdx
sub    %rcx,%rdx
mov    %rdx,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rax,%rdi
add    $0xf,%rdi
and    $0xfffffffffffffff0,%rdi
mov    %rsp,%rcx
sub    %rdi,%rcx
mov    %rcx,%rsp
mov    %rax,-0x38(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rdi
mov    %rdi,-0x40(%rbp)
mov    %rax,%rdi
add    $0xf,%rdi
and    $0xfffffffffffffff0,%rdi
mov    %rsp,%r8
sub    %rdi,%r8
mov    %r8,%rsp
mov    %rax,-0x48(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%r9d
call   1030 <bar@plt>
mov    -0x40(%rbp),%rax
mov    %rax,%rsp
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <foo+0x12>
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1181 <foo+0x71>
mov    %edi,%r14d
mov    %edi,%r15d
lea    -0x1(%r14),%r12d
xor    %ebx,%ebx
add    $0xf,%r15
and    $0xfffffffffffffff0,%r15
cs nopw 0x0(%rax,%rax,1)
mov    %rsp,%r13
mov    %rsp,%rsi
sub    %r15,%rsi
mov    %rsi,%rsp
movb   $0x0,(%rsi,%r12,1)
mov    %rsp,%rdx
sub    %r15,%rdx
mov    %rdx,%rsp
mov    %rsp,%rcx
sub    %r15,%rcx
mov    %rcx,%rsp
mov    %rsp,%r8
sub    %r15,%r8
mov    %r8,%rsp
mov    %ebx,%edi
mov    %r14d,%r9d
call   1030 <bar@plt>
mov    %r13,%rsp
add    $0x1,%ebx
cmp    %ebx,%r14d
jne    1140 <foo+0x30>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @foo(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %18
3: ; preds = %1
%4 = zext i32 %0 to i64
%5 = add nsw i32 %0, -1
%6 = zext i32 %5 to i64
br label %7
7: ; preds = %3, %7
%8 = phi i32 [ 0, %3 ], [ %16, %7 ]
%9 = call i8* @llvm.stacksave()
%10 = alloca i8, i64 %4
%11 = getelementptr inbounds i8, i8* %10, i64 %6
store i8 0, i8* %11
%12 = alloca i8, i64 %4
%13 = alloca i8, i64 %4
%14 = alloca i8, i64 %4
%15 = call i32 @bar(i32 %8, i8* %10, i8* %12, i8* %13, i8* %14, i32 %0)
%16 = add nuw nsw i32 %8, 1
%17 = icmp eq i32 %16, %0
br i1 %17, label %18, label %7
18: ; preds = %7, %1
ret void
}