#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 */
typedef int int8_t;
typedef int /*<<< orphan*/ erased;

/* Variables and functions */
int /*<<< orphan*/ bzero(int *, int);
int8_t *_to_erased(int *erasures) {
  static int8_t erased[512];
  bzero(erased, sizeof(erased));
  for (int i = 0; erasures[i] != -1; i++) {
    erased[erasures[i]] = 1;
  }
  return erased;
}


x86 assembly (clang, -O0):
<_to_erased>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0x2f1d(%rip),%rdi
mov    $0x800,%esi
call   1030 <bzero@plt>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
je     116e <_to_erased+0x5e>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movslq (%rax,%rcx,4),%rcx
lea    0x2ee7(%rip),%rax
movl   $0x1,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1134 <_to_erased+0x24>
lea    0x2ecb(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_to_erased>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0x2f22(%rip),%r14
mov    %r14,%rdi
mov    $0x800,%esi
call   1030 <bzero@plt>
mov    (%rbx),%eax
cmp    $0xffffffff,%eax
je     1155 <_to_erased+0x45>
add    $0x4,%rbx
cs nopw 0x0(%rax,%rax,1)
cltq
movl   $0x1,(%r14,%rax,4)
mov    (%rbx),%eax
add    $0x4,%rbx
cmp    $0xffffffff,%eax
jne    1140 <_to_erased+0x30>
lea    0x2ee4(%rip),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@_to_erased.erased = internal global [512 x i32] zeroinitializer
define i32* @_to_erased(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = call i32 @bzero(i32* getelementptr inbounds ([512 x i32], [512 x i32]* @_to_erased.erased, i64 0, i64 0), i32 2048)
store i32 0, i32* %3
br label %5
5: ; preds = %20, %1
%6 = load i32*, i32** %2
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i32, i32* %6, i64 %8
%10 = load i32, i32* %9
%11 = icmp ne i32 %10, -1
br i1 %11, label %12, label %23
12: ; preds = %5
%13 = load i32*, i32** %2
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
%17 = load i32, i32* %16
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [512 x i32], [512 x i32]* @_to_erased.erased, i64 0, i64 %18
store i32 1, i32* %19
br label %20
20: ; preds = %12
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
br label %5
23: ; preds = %5
ret i32* getelementptr inbounds ([512 x i32], [512 x i32]* @_to_erased.erased, i64 0, i64 0)
}

LLVM IR (-O2):
@_to_erased.erased = internal global [512 x i32] zeroinitializer
define i32* @_to_erased(i32* nocapture %0) {
%2 = tail call i32 @bzero(i32* getelementptr inbounds ([512 x i32], [512 x i32]* @_to_erased.erased, i64 0, i64 0), i32 2048)
%3 = load i32, i32* %0
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %6
5: ; preds = %6, %1
ret i32* getelementptr inbounds ([512 x i32], [512 x i32]* @_to_erased.erased, i64 0, i64 0)
6: ; preds = %1, %6
%7 = phi i64 [ %11, %6 ], [ 0, %1 ]
%8 = phi i32 [ %13, %6 ], [ %3, %1 ]
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [512 x i32], [512 x i32]* @_to_erased.erased, i64 0, i64 %9
store i32 1, i32* %10
%11 = add nuw nsw i64 %7, 1
%12 = getelementptr inbounds i32, i32* %0, i64 %11
%13 = load i32, i32* %12
%14 = icmp eq i32 %13, -1
br i1 %14, label %5, label %6
}