#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 uint8_t;

/* Variables and functions */
int /*<<< orphan*/ memset(int *, int, int);
void _comp128_bitsfrombytes(uint8_t *x, uint8_t *bits) {
  int i;
  memset(bits, 0x00, 128);
  for (i = 0; i < 128; i++)
    if (x[i >> 2] & (1 << (3 - (i & 3))))
      bits[i] = 1;
}


x86 assembly (clang, -O0):
<_comp128_bitsfrombytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1030 <memset@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x80,-0x14(%rbp)
jge    1197 <_comp128_bitsfrombytes+0x87>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sar    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x14(%rbp),%edx
and    $0x3,%edx
mov    $0x3,%ecx
sub    %edx,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1184 <_comp128_bitsfrombytes+0x74>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
jmp    1189 <_comp128_bitsfrombytes+0x79>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1137 <_comp128_bitsfrombytes+0x27>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_comp128_bitsfrombytes>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
mov    %rsi,%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1030 <memset@plt>
jmp    113d <_comp128_bitsfrombytes+0x2d>
xchg   %ax,%ax
add    $0x2,%rbx
cmp    $0x80,%rbx
je     1181 <_comp128_bitsfrombytes+0x71>
mov    %ebx,%eax
and    $0xfffffffc,%eax
mov    (%r15,%rax,1),%eax
mov    %ebx,%ecx
and    $0x2,%cl
xor    $0x3,%cl
movzbl %cl,%ecx
bt     %ecx,%eax
jae    115e <_comp128_bitsfrombytes+0x4e>
movl   $0x1,(%r14,%rbx,4)
mov    %ebx,%eax
and    $0xfffffffc,%eax
mov    (%r15,%rax,1),%eax
mov    %ebx,%ecx
not    %cl
and    $0x2,%cl
movzbl %cl,%ecx
bt     %ecx,%eax
jae    1130 <_comp128_bitsfrombytes+0x20>
movl   $0x1,0x4(%r14,%rbx,4)
jmp    1130 <_comp128_bitsfrombytes+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

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