#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*/ smash(char *, int);
int test3(int n) {
  char test[n];
  smash(test, n);
  goto label;
label:
  smash(test, n);
  char test2[n];
  smash(test2, n);
  return (test - test2 >= n) ? 0 : 1;
}


x86 assembly (clang, -O0):
<test3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%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,-0x28(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%esi
call   1030 <smash@plt>
mov    -0x28(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1030 <smash@plt>
mov    -0x4(%rbp),%eax
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x30(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%esi
call   1030 <smash@plt>
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rax
sub    %rax,%rdx
movslq -0x4(%rbp),%rsi
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    %rsi,%rdx
cmovge %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test3>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edi,%r14d
mov    %edi,%r12d
mov    %rsp,%r15
add    $0xf,%r12
and    $0xfffffffffffffff0,%r12
sub    %r12,%r15
mov    %r15,%rsp
mov    %r15,%rdi
mov    %r14d,%esi
call   1030 <smash@plt>
mov    %r15,%rdi
mov    %r14d,%esi
call   1030 <smash@plt>
mov    %rsp,%rbx
sub    %r12,%rbx
mov    %rbx,%rsp
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <smash@plt>
sub    %rbx,%r15
movslq %r14d,%rcx
xor    %eax,%eax
cmp    %rcx,%r15
setl   %al
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @test3(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = zext i32 %6 to i64
%8 = call i8* @llvm.stacksave()
store i8* %8, i8** %3
%9 = alloca i8, i64 %7
store i64 %7, i64* %4
%10 = load i32, i32* %2
%11 = call i32 @smash(i8* %9, i32 %10)
br label %12
12: ; preds = %1
%13 = load i32, i32* %2
%14 = call i32 @smash(i8* %9, i32 %13)
%15 = load i32, i32* %2
%16 = zext i32 %15 to i64
%17 = alloca i8, i64 %16
store i64 %16, i64* %5
%18 = load i32, i32* %2
%19 = call i32 @smash(i8* %17, i32 %18)
%20 = ptrtoint i8* %9 to i64
%21 = ptrtoint i8* %17 to i64
%22 = sub i64 %20, %21
%23 = load i32, i32* %2
%24 = sext i32 %23 to i64
%25 = icmp sge i64 %22, %24
%26 = zext i1 %25 to i64
%27 = select i1 %25, i32 0, i32 1
%28 = load i8*, i8** %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @test3(i32 %0) {
%2 = zext i32 %0 to i64
%3 = alloca i8, i64 %2
%4 = call i32 @smash(i8* %3, i32 %0)
%5 = call i32 @smash(i8* %3, i32 %0)
%6 = alloca i8, i64 %2
%7 = call i32 @smash(i8* %6, i32 %0)
%8 = ptrtoint i8* %3 to i64
%9 = ptrtoint i8* %6 to i64
%10 = sub i64 %8, %9
%11 = sext i32 %0 to i64
%12 = icmp slt i64 %10, %11
%13 = zext i1 %12 to i32
ret i32 %13
}