#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 char setBit(unsigned char, int);
void putBytes(unsigned char *byte, unsigned int num, int posByte, int posInt,
              int TobeSetted) {
  int setted;
  for (setted = 0; setted < TobeSetted; setted++, posByte++, posInt++) {
    if (isBitiSet(num, posInt))
      (*byte) = setBit((*byte), posByte);
  }
}


x86 assembly (clang, -O0):
<putBytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    119f <putBytes+0x7f>
mov    -0xc(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1030 <isBitiSet@plt>
cmp    $0x0,%rax
je     117a <putBytes+0x5a>
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    -0x10(%rbp),%esi
movzbl %al,%edi
call   1040 <setBit@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
jmp    117f <putBytes+0x5f>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1140 <putBytes+0x20>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putBytes>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %r8d,%r8d
jle    116d <putBytes+0x4d>
mov    %r8d,%r14d
mov    %ecx,%ebp
mov    %edx,%ebx
mov    %esi,%r15d
mov    %rdi,%r12
jmp    114c <putBytes+0x2c>
nopl   0x0(%rax)
add    $0x1,%ebx
add    $0x1,%ebp
add    $0xffffffff,%r14d
je     116d <putBytes+0x4d>
mov    %r15d,%edi
mov    %ebp,%esi
call   1030 <isBitiSet@plt>
test   %rax,%rax
je     1140 <putBytes+0x20>
movzbl (%r12),%edi
mov    %ebx,%esi
call   1040 <setBit@plt>
mov    %al,(%r12)
jmp    1140 <putBytes+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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