#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*/ binary_add(short *, short *);
int /*<<< orphan*/ binary_load(short *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ shiftup(short *);
int /*<<< orphan*/ strlen(char *);
void binary_multiply(short int reg[], char data[]) {
  short int temp[112] = {0};
  short int accum[112] = {0};
  int i;
  binary_load(temp, data, strlen(data));
  for (i = 0; i < 102; i++) {
    if (temp[i] == 1) {
      binary_add(accum, reg);
    }
    shiftup(reg);
  }
  for (i = 0; i < 112; i++) {
    reg[i] = accum[i];
  }
}


x86 assembly (clang, -O0):
<binary_multiply>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1f0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0xf0(%rbp),%rdi
xor    %esi,%esi
mov    $0xe0,%edx
call   1060 <memset@plt>
lea    -0x1d0(%rbp),%rdi
xor    %esi,%esi
mov    $0xe0,%edx
call   1060 <memset@plt>
lea    -0xf0(%rbp),%rax
mov    %rax,-0x1e8(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x1e0(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x1e8(%rbp),%rdi
mov    -0x1e0(%rbp),%rsi
mov    %eax,%edx
call   1070 <binary_load@plt>
movl   $0x0,-0x1d4(%rbp)
cmpl   $0x66,-0x1d4(%rbp)
jge    121c <binary_multiply+0xcc>
movslq -0x1d4(%rbp),%rax
movswl -0xf0(%rbp,%rax,2),%eax
ff
cmp    $0x1,%eax
jne    11ff <binary_multiply+0xaf>
lea    -0x1d0(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <binary_add@plt>
mov    -0x8(%rbp),%rdi
call   1030 <shiftup@plt>
mov    -0x1d4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1d4(%rbp)
jmp    11ca <binary_multiply+0x7a>
movl   $0x0,-0x1d4(%rbp)
cmpl   $0x70,-0x1d4(%rbp)
jge    1265 <binary_multiply+0x115>
movslq -0x1d4(%rbp),%rax
mov    -0x1d0(%rbp,%rax,2),%dx
ff
mov    -0x8(%rbp),%rax
movslq -0x1d4(%rbp),%rcx
mov    %dx,(%rax,%rcx,2)
mov    -0x1d4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1d4(%rbp)
jmp    1226 <binary_multiply+0xd6>
add    $0x1f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<binary_multiply>:
push   %r15
push   %r14
push   %rbx
sub    $0x1c0,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
xorps  %xmm0,%xmm0
movaps %xmm0,0x1b0(%rsp)
movaps %xmm0,0x1a0(%rsp)
movaps %xmm0,0x190(%rsp)
movaps %xmm0,0x180(%rsp)
movaps %xmm0,0x170(%rsp)
movaps %xmm0,0x160(%rsp)
movaps %xmm0,0x150(%rsp)
movaps %xmm0,0x140(%rsp)
movaps %xmm0,0x130(%rsp)
movaps %xmm0,0x120(%rsp)
movaps %xmm0,0x110(%rsp)
movaps %xmm0,0x100(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
mov    %rsi,%rdi
call   1050 <strlen@plt>
lea    0xe0(%rsp),%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1060 <binary_load@plt>
xor    %ebx,%ebx
mov    %rsp,%r14
jmp    1262 <binary_multiply+0x112>
nopl   (%rax)
mov    %r15,%rdi
call   1030 <shiftup@plt>
add    $0x1,%rbx
cmp    $0x66,%rbx
je     127a <binary_multiply+0x12a>
cmpw   $0x1,0xe0(%rsp,%rbx,2)
jne    1250 <binary_multiply+0x100>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <binary_add@plt>
jmp    1250 <binary_multiply+0x100>
mov    %rsp,%rsi
mov    $0xe0,%edx
mov    %r15,%rdi
call   1070 <memcpy@plt>
add    $0x1c0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @binary_multiply(i16* %0, i8* %1) {
%3 = alloca i16*
%4 = alloca i8*
%5 = alloca [112 x i16]
%6 = alloca [112 x i16]
%7 = alloca i32
store i16* %0, i16** %3
store i8* %1, i8** %4
%8 = bitcast [112 x i16]* %5 to i8*
%9 = bitcast [112 x i16]* %6 to i8*
%10 = getelementptr inbounds [112 x i16], [112 x i16]* %5, i64 0, i64 0
%11 = load i8*, i8** %4
%12 = load i8*, i8** %4
%13 = call i32 @strlen(i8* %12)
%14 = call i32 @binary_load(i16* %10, i8* %11, i32 %13)
store i32 0, i32* %7
br label %15
15: ; preds = %32, %2
%16 = load i32, i32* %7
%17 = icmp slt i32 %16, 102
br i1 %17, label %18, label %35
18: ; preds = %15
%19 = load i32, i32* %7
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [112 x i16], [112 x i16]* %5, i64 0, i64 %20
%22 = load i16, i16* %21
%23 = sext i16 %22 to i32
%24 = icmp eq i32 %23, 1
br i1 %24, label %25, label %29
25: ; preds = %18
%26 = getelementptr inbounds [112 x i16], [112 x i16]* %6, i64 0, i64 0
%27 = load i16*, i16** %3
%28 = call i32 @binary_add(i16* %26, i16* %27)
br label %29
29: ; preds = %25, %18
%30 = load i16*, i16** %3
%31 = call i32 @shiftup(i16* %30)
br label %32
32: ; preds = %29
%33 = load i32, i32* %7
%34 = add nsw i32 %33, 1
store i32 %34, i32* %7
br label %15
35: ; preds = %15
store i32 0, i32* %7
br label %36
36: ; preds = %48, %35
%37 = load i32, i32* %7
%38 = icmp slt i32 %37, 112
br i1 %38, label %39, label %51
39: ; preds = %36
%40 = load i32, i32* %7
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [112 x i16], [112 x i16]* %6, i64 0, i64 %41
%43 = load i16, i16* %42
%44 = load i16*, i16** %3
%45 = load i32, i32* %7
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i16, i16* %44, i64 %46
store i16 %43, i16* %47
br label %48
48: ; preds = %39
%49 = load i32, i32* %7
%50 = add nsw i32 %49, 1
store i32 %50, i32* %7
br label %36
51: ; preds = %36
ret void
}

LLVM IR (-O2):
define void @binary_multiply(i16* %0, i8* %1) {
%3 = alloca [112 x i16]
%4 = alloca [112 x i16]
%5 = bitcast [112 x i16]* %4 to i8*
%6 = bitcast [112 x i16]* %3 to i8*
%7 = getelementptr inbounds [112 x i16], [112 x i16]* %3, i64 0, i64 0
%8 = tail call i32 @strlen(i8* %1)
%9 = call i32 @binary_load(i16* %7, i8* %1, i32 %8)
%10 = getelementptr inbounds [112 x i16], [112 x i16]* %4, i64 0, i64 0
br label %11
11: ; preds = %2, %18
%12 = phi i64 [ 0, %2 ], [ %20, %18 ]
%13 = getelementptr inbounds [112 x i16], [112 x i16]* %3, i64 0, i64 %12
%14 = load i16, i16* %13
%15 = icmp eq i16 %14, 1
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = call i32 @binary_add(i16* %10, i16* %0)
br label %18
18: ; preds = %16, %11
%19 = call i32 @shiftup(i16* %0)
%20 = add nuw nsw i64 %12, 1
%21 = icmp eq i64 %20, 102
br i1 %21, label %22, label %11
22: ; preds = %18
%23 = bitcast i16* %0 to i8*
ret void
}