#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 */
scalar_t__ isBitiSet(unsigned int, int);
unsigned int setBit(unsigned int, int);
void decimalToBinary(unsigned int num, unsigned int *byte, int pos, int end) {
  if (pos == end)
    return;
  if (isBitiSet(num, pos))
    (*byte) = setBit((*byte), pos);
  decimalToBinary(num, &(*byte), pos + 1, end);
}


x86 assembly (clang, -O0):
<decimalToBinary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    1156 <decimalToBinary+0x26>
jmp    1196 <decimalToBinary+0x66>
mov    -0x4(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1040 <isBitiSet@plt>
cmp    $0x0,%rax
je     1181 <decimalToBinary+0x51>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%esi
call   1050 <setBit@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
add    $0x1,%edx
mov    -0x18(%rbp),%ecx
call   1030 <decimalToBinary@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decimalToBinary>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %ecx,%edx
jne    1136 <decimalToBinary+0x16>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %ecx,%r14d
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %edi,%r15d
jmp    1158 <decimalToBinary+0x38>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%ebp
cmp    %ebp,%r14d
je     112b <decimalToBinary+0xb>
mov    %r15d,%edi
mov    %ebp,%esi
call   1030 <isBitiSet@plt>
test   %rax,%rax
je     1150 <decimalToBinary+0x30>
mov    (%rbx),%edi
mov    %ebp,%esi
call   1040 <setBit@plt>
mov    %eax,(%rbx)
jmp    1150 <decimalToBinary+0x30>

LLVM IR (-O0):
define void @decimalToBinary(i32 %0, i32* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %7
%10 = load i32, i32* %8
%11 = icmp eq i32 %9, %10
br i1 %11, label %12, label %13
12: ; preds = %4
br label %30
13: ; preds = %4
%14 = load i32, i32* %5
%15 = load i32, i32* %7
%16 = call i64 @isBitiSet(i32 %14, i32 %15)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %13
%19 = load i32*, i32** %6
%20 = load i32, i32* %19
%21 = load i32, i32* %7
%22 = call i32 @setBit(i32 %20, i32 %21)
%23 = load i32*, i32** %6
store i32 %22, i32* %23
br label %24
24: ; preds = %18, %13
%25 = load i32, i32* %5
%26 = load i32*, i32** %6
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
%29 = load i32, i32* %8
br label %30
30: ; preds = %24, %12
ret void
}

LLVM IR (-O2):
define void @decimalToBinary(i32 %0, i32* nocapture %1, i32 %2, i32 %3) {
%5 = icmp eq i32 %2, %3
br i1 %5, label %16, label %6
6: ; preds = %4, %13
%7 = phi i32 [ %14, %13 ], [ %2, %4 ]
%8 = tail call i64 @isBitiSet(i32 %0, i32 %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %6
%11 = load i32, i32* %1
%12 = tail call i32 @setBit(i32 %11, i32 %7)
store i32 %12, i32* %1
br label %13
13: ; preds = %10, %6
%14 = add nsw i32 %7, 1
%15 = icmp eq i32 %14, %3
br i1 %15, label %16, label %6
16: ; preds = %13, %4
ret void
}