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);
      }
    }
    __asm __volatile("" : : "r"(&temp[0]), "r"(&temp2[0]) : "memory");
  }
}


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,-0x50(%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,-0x58(%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
mov    $0x0,%al
call   1030 <bar@plt>
mov    -0x58(%rbp),%rcx
mov    -0x50(%rbp),%rax
mov    -0x40(%rbp),%rdx
mov    %rdx,%rsp
mov    -0x30(%rbp),%rdx
mov    %rdx,%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):
<foo>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
movslq %edi,%r8
movb   $0x0,-0x1(%r8,%rbx,1)
mov    %rsp,%r14
sub    %rax,%r14
mov    %r14,%rsp
mov    %rsp,%r15
mov    %rsp,%rdx
sub    %rax,%rdx
mov    %rdx,%rsp
mov    %rsp,%rcx
sub    %rax,%rcx
mov    %rcx,%rsp
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <bar@plt>
mov    %r15,%rsp
lea    -0x18(%rbp),%rsp
pop    %rbx
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 (i8*, i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @bar to i32 (i8*, i8*, i8*, i8*, i32, ...)*)(i8* %14, i8* %22, i8* %26, i8* %30, i32 %31)
%33 = load i8*, i8** %9
%34 = load i8*, i8** %7
%35 = getelementptr inbounds i8, i8* %14, i64 0
%36 = getelementptr inbounds i8, i8* %22, i64 0
%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 (i8*, i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @bar to i32 (i8*, i8*, i8*, i8*, i32, ...)*)(i8* %3, i8* %7, i8* %9, i8* %10, i32 %0)
ret void
}