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


x86 assembly (clang, -O0):
<foo2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,%rsp
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
cltq
movb   $0x0,(%rax,%rdi,1)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdx
sub    %rcx,%rdx
mov    %rdx,%rsp
mov    %rax,-0x38(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rax,%r8
add    $0xf,%r8
and    $0xfffffffffffffff0,%r8
mov    %rsp,%rcx
sub    %r8,%rcx
mov    %rcx,%rsp
mov    %rax,-0x48(%rbp)
mov    -0x4(%rbp),%r8d
call   1030 <bar2@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    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,%eax
mov    %rsp,%r9
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r9
mov    %r9,%rsp
movslq %edi,%r8
movb   $0x0,-0x1(%r8,%r9,1)
mov    %rsp,%rsi
sub    %rax,%rsi
mov    %rsi,%rsp
mov    %rsp,%rdx
sub    %rax,%rdx
mov    %rdx,%rsp
mov    %rsp,%rcx
sub    %rax,%rcx
mov    %rcx,%rsp
mov    %r9,%rdi
call   1030 <bar2@plt>
mov    %rbp,%rsp
pop    %rbp
ret

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

LLVM IR (-O2):
define void @foo2(i32 %0) {
%2 = zext i32 %0 to i64
%3 = alloca i8, i64 %2
%4 = add nsw i32 %0, -1
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %3, i64 %5
store i8 0, i8* %6
%7 = alloca i8, i64 %2
%8 = alloca i8, i64 %2
%9 = alloca i8, i64 %2
%10 = call i32 @bar2(i8* %3, i8* %7, i8* %8, i8* %9, i32 %0)
ret void
}