#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*/ sumOfArrayElements(int *, int);
unsigned multiplicacionRusa(unsigned x, unsigned y) {
  int i = 0, imparesStack[30] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  while (x >= 1) {
    if (x % 2 != 0)
      imparesStack[i++] = y;
    x /= 2;
    y *= 2;
  }
  return (unsigned)sumOfArrayElements(imparesStack, 30);
}


x86 assembly (clang, -O0):
<multiplicacionRusa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x78,%edx
call   1030 <memset@plt>
cmpl   $0x1,-0x4(%rbp)
jb     1192 <multiplicacionRusa+0x72>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     117b <multiplicacionRusa+0x5b>
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
cltq
mov    %ecx,-0x90(%rbp,%rax,4)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114b <multiplicacionRusa+0x2b>
lea    -0x90(%rbp),%rdi
mov    $0x1e,%esi
call   1040 <sumOfArrayElements@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<multiplicacionRusa>:
sub    $0x78,%rsp
xorps  %xmm0,%xmm0
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)
movq   $0x0,0x70(%rsp)
test   %edi,%edi
je     116e <multiplicacionRusa+0x5e>
xor    %eax,%eax
jmp    115d <multiplicacionRusa+0x4d>
nopw   0x0(%rax,%rax,1)
mov    %edi,%ecx
shr    %ecx
add    %esi,%esi
cmp    $0x1,%edi
mov    %ecx,%edi
jbe    116e <multiplicacionRusa+0x5e>
test   $0x1,%dil
je     1150 <multiplicacionRusa+0x40>
movslq %eax,%rcx
add    $0x1,%eax
mov    %esi,(%rsp,%rcx,4)
jmp    1150 <multiplicacionRusa+0x40>
mov    %rsp,%rdi
mov    $0x1e,%esi
call   1030 <sumOfArrayElements@plt>
add    $0x78,%rsp
ret

LLVM IR (-O0):
define i32 @multiplicacionRusa(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [30 x i32]
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
%7 = bitcast [30 x i32]* %6 to i8*
br label %8
8: ; preds = %21, %2
%9 = load i32, i32* %3
%10 = icmp uge i32 %9, 1
br i1 %10, label %11, label %26
11: ; preds = %8
%12 = load i32, i32* %3
%13 = urem i32 %12, 2
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %21
15: ; preds = %11
%16 = load i32, i32* %4
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 1
store i32 %18, i32* %5
%19 = sext i32 %17 to i64
%20 = getelementptr inbounds [30 x i32], [30 x i32]* %6, i64 0, i64 %19
store i32 %16, i32* %20
br label %21
21: ; preds = %15, %11
%22 = load i32, i32* %3
%23 = udiv i32 %22, 2
store i32 %23, i32* %3
%24 = load i32, i32* %4
%25 = mul i32 %24, 2
store i32 %25, i32* %4
br label %8
26: ; preds = %8
%27 = getelementptr inbounds [30 x i32], [30 x i32]* %6, i64 0, i64 0
%28 = call i32 @sumOfArrayElements(i32* %27, i32 30)
ret i32 %28
}

LLVM IR (-O2):
define i32 @multiplicacionRusa(i32 %0, i32 %1) {
%3 = alloca [30 x i32]
%4 = bitcast [30 x i32]* %3 to i8*
%5 = icmp eq i32 %0, 0
br i1 %5, label %21, label %6
6: ; preds = %2, %16
%7 = phi i32 [ %17, %16 ], [ 0, %2 ]
%8 = phi i32 [ %19, %16 ], [ %1, %2 ]
%9 = phi i32 [ %18, %16 ], [ %0, %2 ]
%10 = and i32 %9, 1
%11 = icmp eq i32 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %6
%13 = add nsw i32 %7, 1
%14 = sext i32 %7 to i64
%15 = getelementptr inbounds [30 x i32], [30 x i32]* %3, i64 0, i64 %14
store i32 %8, i32* %15
br label %16
16: ; preds = %12, %6
%17 = phi i32 [ %13, %12 ], [ %7, %6 ]
%18 = lshr i32 %9, 1
%19 = shl i32 %8, 1
%20 = icmp ult i32 %9, 2
br i1 %20, label %21, label %6
21: ; preds = %16, %2
%22 = getelementptr inbounds [30 x i32], [30 x i32]* %3, i64 0, i64 0
%23 = call i32 @sumOfArrayElements(i32* %22, i32 30)
ret i32 %23
}