#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 scalar_t__ uint8_t;
typedef int int8_t;

/* Variables and functions */
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, unsigned int);
void depunct(uint8_t *in, int8_t *out, unsigned size, unsigned *pattern) {
  int i;
  memset(out, 0, size);
  for (i = 0; i < 456; i++) {
    out[pattern[i]] = in[i] ? -127 : 127;
  }
}


x86 assembly (clang, -O0):
<depunct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
xor    %esi,%esi
call   1030 <memset@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x1c8,-0x24(%rbp)
jge    1186 <depunct+0x76>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
mov    $0x7f,%edx
mov    $0xffffff81,%eax
cmp    $0x0,%rcx
cmovne %eax,%edx
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movslq -0x24(%rbp),%rsi
mov    (%rcx,%rsi,4),%ecx
mov    %edx,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    113c <depunct+0x2c>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<depunct>:
push   %r15
push   %r14
push   %rbx
mov    %rcx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
mov    %rsi,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
mov    $0x2,%eax
mov    $0x7f,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmpq   $0x0,-0x10(%rbx,%rax,8)
mov    $0xffffff81,%edx
cmove  %ecx,%edx
mov    -0x8(%r14,%rax,4),%esi
mov    %edx,(%r15,%rsi,4)
cmpq   $0x0,-0x8(%rbx,%rax,8)
mov    $0xffffff81,%edx
cmove  %ecx,%edx
mov    -0x4(%r14,%rax,4),%esi
mov    %edx,(%r15,%rsi,4)
cmpq   $0x0,(%rbx,%rax,8)
mov    $0xffffff81,%edx
cmove  %ecx,%edx
mov    (%r14,%rax,4),%esi
mov    %edx,(%r15,%rsi,4)
add    $0x3,%rax
cmp    $0x1ca,%rax
jne    1140 <depunct+0x30>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @depunct(i64* %0, i32* %1, i32 %2, i32* %3) {
%5 = alloca i64*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
store i64* %0, i64** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i32* %3, i32** %8
%10 = load i32*, i32** %6
%11 = load i32, i32* %7
%12 = call i32 @memset(i32* %10, i32 0, i32 %11)
store i32 0, i32* %9
br label %13
13: ; preds = %33, %4
%14 = load i32, i32* %9
%15 = icmp slt i32 %14, 456
br i1 %15, label %16, label %36
16: ; preds = %13
%17 = load i64*, i64** %5
%18 = load i32, i32* %9
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i64, i64* %17, i64 %19
%21 = load i64, i64* %20
%22 = icmp ne i64 %21, 0
%23 = zext i1 %22 to i64
%24 = select i1 %22, i32 -127, i32 127
%25 = load i32*, i32** %6
%26 = load i32*, i32** %8
%27 = load i32, i32* %9
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i32, i32* %26, i64 %28
%30 = load i32, i32* %29
%31 = zext i32 %30 to i64
%32 = getelementptr inbounds i32, i32* %25, i64 %31
store i32 %24, i32* %32
br label %33
33: ; preds = %16
%34 = load i32, i32* %9
%35 = add nsw i32 %34, 1
store i32 %35, i32* %9
br label %13
36: ; preds = %13
ret void
}

LLVM IR (-O2):
define void @depunct(i64* nocapture %0, i32* %1, i32 %2, i32* nocapture %3) {
%5 = tail call i32 @memset(i32* %1, i32 0, i32 %2)
br label %6
6: ; preds = %6, %4
%7 = phi i64 [ 0, %4 ], [ %34, %6 ]
%8 = getelementptr inbounds i64, i64* %0, i64 %7
%9 = load i64, i64* %8
%10 = icmp eq i64 %9, 0
%11 = select i1 %10, i32 127, i32 -127
%12 = getelementptr inbounds i32, i32* %3, i64 %7
%13 = load i32, i32* %12
%14 = zext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %1, i64 %14
store i32 %11, i32* %15
%16 = add nuw nsw i64 %7, 1
%17 = getelementptr inbounds i64, i64* %0, i64 %16
%18 = load i64, i64* %17
%19 = icmp eq i64 %18, 0
%20 = select i1 %19, i32 127, i32 -127
%21 = getelementptr inbounds i32, i32* %3, i64 %16
%22 = load i32, i32* %21
%23 = zext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %1, i64 %23
store i32 %20, i32* %24
%25 = add nuw nsw i64 %7, 2
%26 = getelementptr inbounds i64, i64* %0, i64 %25
%27 = load i64, i64* %26
%28 = icmp eq i64 %27, 0
%29 = select i1 %28, i32 127, i32 -127
%30 = getelementptr inbounds i32, i32* %3, i64 %25
%31 = load i32, i32* %30
%32 = zext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %1, i64 %32
store i32 %29, i32* %33
%34 = add nuw nsw i64 %7, 3
%35 = icmp eq i64 %34, 456
br i1 %35, label %36, label %6
36: ; preds = %6
ret void
}