#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 pow(int, int);
int Dec2Bin(int AnyValueWithinIntRange) {
  int ResultOfTheFunction = 0;
  int Count_D = AnyValueWithinIntRange;
  int i;
  for (i = 0; i <= 7; i++) {
    ResultOfTheFunction = ResultOfTheFunction + (Count_D % 2) * pow(10, i);
    Count_D = Count_D / 2;
  }
  return ResultOfTheFunction;
}


x86 assembly (clang, -O0):
<Dec2Bin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x7,-0x10(%rbp)
jg     1186 <Dec2Bin+0x76>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%esi
mov    $0xa,%edi
call   1030 <pow@plt>
mov    -0x18(%rbp),%edx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
imul   %ecx,%edx
add    %edx,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112f <Dec2Bin+0x1f>
mov    -0x8(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Dec2Bin>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edi,%ebx
lea    0x7f(%rbx),%eax
test   %edi,%edi
cmovns %edi,%eax
mov    %eax,0x14(%rsp)
lea    0x3f(%rbx),%eax
test   %edi,%edi
cmovns %edi,%eax
mov    %eax,0x10(%rsp)
lea    0x1f(%rbx),%eax
test   %edi,%edi
cmovns %edi,%eax
mov    %eax,0xc(%rsp)
lea    0xf(%rbx),%eax
test   %edi,%edi
cmovns %edi,%eax
mov    %eax,0x8(%rsp)
lea    0x7(%rbx),%r14d
test   %edi,%edi
cmovns %edi,%r14d
lea    0x3(%rbx),%r15d
test   %edi,%edi
cmovns %edi,%r15d
mov    $0xa,%edi
xor    %esi,%esi
call   1030 <pow@plt>
mov    %eax,%ebp
mov    %ebx,%eax
shr    $0x1f,%eax
add    %ebx,%eax
mov    %eax,%ecx
and    $0xfffffffe,%ecx
sub    %ecx,%ebx
imul   %ebx,%ebp
mov    %eax,%r12d
sar    %r12d
shr    $0x1f,%eax
add    %r12d,%eax
and    $0xfffffffe,%eax
sub    %eax,%r12d
mov    $0xa,%edi
mov    $0x1,%esi
call   1030 <pow@plt>
mov    %eax,%r13d
imul   %r12d,%r13d
add    %ebp,%r13d
mov    %r15d,%ebx
sar    $0x2,%ebx
shr    $0x1f,%r15d
add    %ebx,%r15d
and    $0xfffffffe,%r15d
sub    %r15d,%ebx
mov    $0xa,%edi
mov    $0x2,%esi
call   1030 <pow@plt>
mov    %eax,%ebp
imul   %ebx,%ebp
add    %r13d,%ebp
mov    %r14d,%ebx
sar    $0x3,%ebx
shr    $0x1f,%r14d
add    %ebx,%r14d
and    $0xfffffffe,%r14d
sub    %r14d,%ebx
mov    $0xa,%edi
mov    $0x3,%esi
call   1030 <pow@plt>
mov    %eax,%r14d
imul   %ebx,%r14d
add    %ebp,%r14d
mov    0x8(%rsp),%eax
mov    %eax,%ebx
sar    $0x4,%ebx
shr    $0x1f,%eax
add    %ebx,%eax
and    $0xfffffffe,%eax
sub    %eax,%ebx
mov    $0xa,%edi
mov    $0x4,%esi
call   1030 <pow@plt>
mov    %eax,%ebp
imul   %ebx,%ebp
add    %r14d,%ebp
mov    0xc(%rsp),%eax
mov    %eax,%ebx
sar    $0x5,%ebx
shr    $0x1f,%eax
add    %ebx,%eax
and    $0xfffffffe,%eax
sub    %eax,%ebx
mov    $0xa,%edi
mov    $0x5,%esi
call   1030 <pow@plt>
mov    %eax,%r14d
imul   %ebx,%r14d
add    %ebp,%r14d
mov    0x10(%rsp),%eax
mov    %eax,%ebx
sar    $0x6,%ebx
shr    $0x1f,%eax
add    %ebx,%eax
and    $0xfffffffe,%eax
sub    %eax,%ebx
mov    $0xa,%edi
mov    $0x6,%esi
call   1030 <pow@plt>
mov    %eax,%ebp
imul   %ebx,%ebp
add    %r14d,%ebp
mov    0x14(%rsp),%eax
mov    %eax,%ebx
sar    $0x7,%ebx
shr    $0x1f,%eax
add    %ebx,%eax
and    $0xfffffffe,%eax
sub    %eax,%ebx
mov    $0xa,%edi
mov    $0x7,%esi
call   1030 <pow@plt>
imul   %ebx,%eax
add    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @Dec2Bin(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%6 = load i32, i32* %2
store i32 %6, i32* %4
store i32 0, i32* %5
br label %7
7: ; preds = %20, %1
%8 = load i32, i32* %5
%9 = icmp sle i32 %8, 7
br i1 %9, label %10, label %23
10: ; preds = %7
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = srem i32 %12, 2
%14 = load i32, i32* %5
%15 = call i32 @pow(i32 10, i32 %14)
%16 = mul nsw i32 %13, %15
%17 = add nsw i32 %11, %16
store i32 %17, i32* %3
%18 = load i32, i32* %4
%19 = sdiv i32 %18, 2
store i32 %19, i32* %4
br label %20
20: ; preds = %10
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 1
store i32 %22, i32* %5
br label %7
23: ; preds = %7
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @Dec2Bin(i32 %0) {
%2 = srem i32 %0, 2
%3 = tail call i32 @pow(i32 10, i32 0)
%4 = mul nsw i32 %3, %2
%5 = sdiv i32 %0, 2
%6 = srem i32 %5, 2
%7 = tail call i32 @pow(i32 10, i32 1)
%8 = mul nsw i32 %7, %6
%9 = add nsw i32 %8, %4
%10 = sdiv i32 %0, 4
%11 = srem i32 %10, 2
%12 = tail call i32 @pow(i32 10, i32 2)
%13 = mul nsw i32 %12, %11
%14 = add nsw i32 %13, %9
%15 = sdiv i32 %0, 8
%16 = srem i32 %15, 2
%17 = tail call i32 @pow(i32 10, i32 3)
%18 = mul nsw i32 %17, %16
%19 = add nsw i32 %18, %14
%20 = sdiv i32 %0, 16
%21 = srem i32 %20, 2
%22 = tail call i32 @pow(i32 10, i32 4)
%23 = mul nsw i32 %22, %21
%24 = add nsw i32 %23, %19
%25 = sdiv i32 %0, 32
%26 = srem i32 %25, 2
%27 = tail call i32 @pow(i32 10, i32 5)
%28 = mul nsw i32 %27, %26
%29 = add nsw i32 %28, %24
%30 = sdiv i32 %0, 64
%31 = srem i32 %30, 2
%32 = tail call i32 @pow(i32 10, i32 6)
%33 = mul nsw i32 %32, %31
%34 = add nsw i32 %33, %29
%35 = sdiv i32 %0, 128
%36 = srem i32 %35, 2
%37 = tail call i32 @pow(i32 10, i32 7)
%38 = mul nsw i32 %37, %36
%39 = add nsw i32 %38, %34
ret i32 %39
}