#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 */
void burn_stack(int bytes) {
  char buf[64];
  do {
    volatile char *_vptr = (volatile char *)(buf);
    size_t _vlen = (sizeof buf);
    while (_vlen) {
      *_vptr = (0);
      _vptr++;
      _vlen--;
    }
  } while (0);
  bytes -= sizeof buf;
  if (bytes > 0)
    burn_stack(bytes);
}


x86 assembly (clang, -O0):
<burn_stack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x50(%rbp),%rax
mov    %rax,-0x58(%rbp)
movq   $0x40,-0x60(%rbp)
cmpq   $0x0,-0x60(%rbp)
je     115a <burn_stack+0x4a>
mov    -0x58(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x58(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
mov    -0x60(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x60(%rbp)
jmp    112b <burn_stack+0x1b>
jmp    115f <burn_stack+0x4f>
movslq -0x4(%rbp),%rax
sub    $0x40,%rax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    117c <burn_stack+0x6c>
mov    -0x4(%rbp),%edi
call   1030 <burn_stack@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<burn_stack>:
sub    $0x38,%rsp
movb   $0x0,-0x50(%rsp)
movb   $0x0,0x37(%rsp)
movb   $0x0,0x16(%rsp)
movb   $0x0,0x36(%rsp)
movb   $0x0,-0xc(%rsp)
movb   $0x0,0x35(%rsp)
movb   $0x0,0x14(%rsp)
movb   $0x0,0x34(%rsp)
movb   $0x0,-0x30(%rsp)
movb   $0x0,0x33(%rsp)
movb   $0x0,0x12(%rsp)
movb   $0x0,0x32(%rsp)
movb   $0x0,-0x10(%rsp)
movb   $0x0,0x31(%rsp)
movb   $0x0,0x10(%rsp)
movb   $0x0,0x30(%rsp)
movb   $0x0,-0x60(%rsp)
movb   $0x0,0x2f(%rsp)
movb   $0x0,0xe(%rsp)
movb   $0x0,0x2e(%rsp)
movb   $0x0,-0x14(%rsp)
movb   $0x0,0x2d(%rsp)
movb   $0x0,0xc(%rsp)
movb   $0x0,0x2c(%rsp)
movb   $0x0,-0x38(%rsp)
movb   $0x0,0x2b(%rsp)
movb   $0x0,0xa(%rsp)
movb   $0x0,0x2a(%rsp)
movb   $0x0,-0x18(%rsp)
movb   $0x0,0x29(%rsp)
movb   $0x0,0x8(%rsp)
movb   $0x0,0x28(%rsp)
movb   $0x0,-0x70(%rsp)
movb   $0x0,0x27(%rsp)
movb   $0x0,0x6(%rsp)
movb   $0x0,0x26(%rsp)
movb   $0x0,-0x1c(%rsp)
movb   $0x0,0x25(%rsp)
movb   $0x0,0x4(%rsp)
movb   $0x0,0x24(%rsp)
movb   $0x0,-0x40(%rsp)
movb   $0x0,0x23(%rsp)
movb   $0x0,0x2(%rsp)
movb   $0x0,0x22(%rsp)
movb   $0x0,-0x20(%rsp)
movb   $0x0,0x21(%rsp)
movb   $0x0,(%rsp)
movb   $0x0,0x20(%rsp)
movb   $0x0,-0x80(%rsp)
movb   $0x0,0x1f(%rsp)
movb   $0x0,-0x2(%rsp)
movb   $0x0,0x1e(%rsp)
movb   $0x0,-0x24(%rsp)
movb   $0x0,0x1d(%rsp)
movb   $0x0,-0x4(%rsp)
movb   $0x0,0x1c(%rsp)
movb   $0x0,-0x48(%rsp)
movb   $0x0,0x1b(%rsp)
movb   $0x0,-0x6(%rsp)
movb   $0x0,0x1a(%rsp)
movb   $0x0,-0x28(%rsp)
movb   $0x0,0x19(%rsp)
movb   $0x0,-0x8(%rsp)
movb   $0x0,0x18(%rsp)
add    $0xffffffc0,%edi
add    $0x38,%rsp
test   %edi,%edi
jle    1263 <burn_stack+0x153>
jmp    1030 <burn_stack@plt>
ret

LLVM IR (-O0):
define void @burn_stack(i32 %0) {
%2 = alloca i32
%3 = alloca [64 x i8]
%4 = alloca i8*
%5 = alloca i64
store i32 %0, i32* %2
br label %6
6: ; preds = %1
%7 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
store i8* %7, i8** %4
store i64 64, i64* %5
br label %8
8: ; preds = %11, %6
%9 = load i64, i64* %5
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %17
11: ; preds = %8
%12 = load i8*, i8** %4
store volatile i8 0, i8* %12
%13 = load i8*, i8** %4
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %4
%15 = load i64, i64* %5
%16 = add i64 %15, -1
store i64 %16, i64* %5
br label %8
17: ; preds = %8
br label %18
18: ; preds = %17
%19 = load i32, i32* %2
%20 = sext i32 %19 to i64
%21 = sub i64 %20, 64
%22 = trunc i64 %21 to i32
store i32 %22, i32* %2
%23 = load i32, i32* %2
%24 = icmp sgt i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %18
%26 = load i32, i32* %2
br label %27
27: ; preds = %25, %18
ret void
}

LLVM IR (-O2):
define void @burn_stack(i32 %0) {
%2 = alloca i8
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
%10 = alloca i8
%11 = alloca i8
%12 = alloca i8
%13 = alloca i8
%14 = alloca i8
%15 = alloca i8
%16 = alloca i8
%17 = alloca i8
%18 = alloca i8
%19 = alloca i8
%20 = alloca i8
%21 = alloca i8
%22 = alloca i8
%23 = alloca i8
%24 = alloca i8
%25 = alloca i8
%26 = alloca i8
%27 = alloca i8
%28 = alloca i8
%29 = alloca i8
%30 = alloca i8
%31 = alloca i8
%32 = alloca i8
%33 = alloca i8
%34 = alloca i8
%35 = alloca i8
%36 = alloca i8
%37 = alloca i8
%38 = alloca i8
%39 = alloca i8
%40 = alloca i8
%41 = alloca i8
%42 = alloca i8
%43 = alloca i8
%44 = alloca i8
%45 = alloca i8
%46 = alloca i8
%47 = alloca i8
%48 = alloca i8
%49 = alloca i8
%50 = alloca i8
%51 = alloca i8
%52 = alloca i8
%53 = alloca i8
%54 = alloca i8
%55 = alloca i8
%56 = alloca i8
%57 = alloca i8
%58 = alloca i8
%59 = alloca i8
%60 = alloca i8
%61 = alloca i8
%62 = alloca i8
%63 = alloca i8
%64 = alloca i8
%65 = alloca i8
store volatile i8 0, i8* %2
store volatile i8 0, i8* %3
store volatile i8 0, i8* %4
store volatile i8 0, i8* %5
store volatile i8 0, i8* %6
store volatile i8 0, i8* %7
store volatile i8 0, i8* %8
store volatile i8 0, i8* %9
store volatile i8 0, i8* %10
store volatile i8 0, i8* %11
store volatile i8 0, i8* %12
store volatile i8 0, i8* %13
store volatile i8 0, i8* %14
store volatile i8 0, i8* %15
store volatile i8 0, i8* %16
store volatile i8 0, i8* %17
store volatile i8 0, i8* %18
store volatile i8 0, i8* %19
store volatile i8 0, i8* %20
store volatile i8 0, i8* %21
store volatile i8 0, i8* %22
store volatile i8 0, i8* %23
store volatile i8 0, i8* %24
store volatile i8 0, i8* %25
store volatile i8 0, i8* %26
store volatile i8 0, i8* %27
store volatile i8 0, i8* %28
store volatile i8 0, i8* %29
store volatile i8 0, i8* %30
store volatile i8 0, i8* %31
store volatile i8 0, i8* %32
store volatile i8 0, i8* %33
store volatile i8 0, i8* %34
store volatile i8 0, i8* %35
store volatile i8 0, i8* %36
store volatile i8 0, i8* %37
store volatile i8 0, i8* %38
store volatile i8 0, i8* %39
store volatile i8 0, i8* %40
store volatile i8 0, i8* %41
store volatile i8 0, i8* %42
store volatile i8 0, i8* %43
store volatile i8 0, i8* %44
store volatile i8 0, i8* %45
store volatile i8 0, i8* %46
store volatile i8 0, i8* %47
store volatile i8 0, i8* %48
store volatile i8 0, i8* %49
store volatile i8 0, i8* %50
store volatile i8 0, i8* %51
store volatile i8 0, i8* %52
store volatile i8 0, i8* %53
store volatile i8 0, i8* %54
store volatile i8 0, i8* %55
store volatile i8 0, i8* %56
store volatile i8 0, i8* %57
store volatile i8 0, i8* %58
store volatile i8 0, i8* %59
store volatile i8 0, i8* %60
store volatile i8 0, i8* %61
store volatile i8 0, i8* %62
store volatile i8 0, i8* %63
store volatile i8 0, i8* %64
store volatile i8 0, i8* %65
%66 = add i32 %0, -64
%67 = icmp sgt i32 %66, 0
br i1 %67, label %68, label %69
68: ; preds = %1
tail call void @burn_stack(i32 %66)
br label %69
69: ; preds = %68, %1
ret void
}