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


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%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,-0x58(%rbp)
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,-0x50(%rbp)
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 <bar@plt>
mov    -0x58(%rbp),%rdi
mov    -0x50(%rbp),%rsi
mov    -0x40(%rbp),%rax
mov    %rax,%rsp
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%ecx
mov    %rcx,%rdx
call   1030 <bar@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edi,%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
movslq %edi,%r14
movb   $0x0,-0x1(%r14,%rbx,1)
mov    %rsp,%r15
sub    %rax,%r15
mov    %r15,%rsp
mov    %rsp,%r12
mov    %rsp,%rdx
sub    %rax,%rdx
mov    %rdx,%rsp
mov    %rsp,%rcx
sub    %rax,%rcx
mov    %rcx,%rsp
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14d,%r8d
call   1030 <bar@plt>
mov    %r12,%rsp
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
mov    %r14d,%r8d
call   1030 <bar@plt>
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @foo(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 @bar(i8* %14, i8* %22, i8* %26, i8* %30, i32 %31)
%33 = load i8*, i8** %9
%34 = load i8*, i8** %7
%35 = load i32, i32* %2
%36 = call i32 @bar(i8* %14, i8* %22, i8* null, i8* null, i32 %35)
%37 = load i8*, i8** %5
%38 = load i8*, i8** %3
ret void
}

LLVM IR (-O2):
define void @foo(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 = tail call i8* @llvm.stacksave()
%9 = alloca i8, i64 %2
%10 = alloca i8, i64 %2
%11 = call i32 @bar(i8* %3, i8* %7, i8* %9, i8* %10, i32 %0)
%12 = call i32 @bar(i8* %3, i8* %7, i8* null, i8* null, i32 %0)
ret void
}