#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 */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ insertBits(int /*<<< orphan*/, int /*<<< orphan*/, int, int);
char *intToBaseString(int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, char *, ...);
void insertionBitsTester(int32_t original, int32_t bitsToInsert, int from,
                         int to) {
  printf("N: %s, M: %s, j: %d, i: %i\n", intToBaseString(original, 2),
         intToBaseString(bitsToInsert, 2), from, to);
  printf("N: %s \n",
         intToBaseString(insertBits(original, bitsToInsert, from, to), 2));
}


x86 assembly (clang, -O0):
<insertionBitsTester>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x2,%esi
call   1040 <intToBaseString@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x2,%esi
call   1040 <intToBaseString@plt>
mov    -0x18(%rbp),%rsi
mov    %rax,%rdx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1050 <insertBits@plt>
mov    %eax,%edi
mov    $0x2,%esi
call   1040 <intToBaseString@plt>
mov    %rax,%rsi
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<insertionBitsTester>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x2,%esi
call   1040 <intToBaseString@plt>
mov    %rax,%r12
mov    %ebx,%edi
mov    $0x2,%esi
call   1040 <intToBaseString@plt>
lea    0xe9e(%rip),%rdi
mov    %r12,%rsi
mov    %rax,%rdx
mov    %r15d,%ecx
mov    %r14d,%r8d
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebp,%edi
mov    %ebx,%esi
mov    %r15d,%edx
mov    %r14d,%ecx
call   1050 <insertBits@plt>
mov    %eax,%edi
mov    $0x2,%esi
call   1040 <intToBaseString@plt>
lea    0xe85(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"N: %s, M: %s, j: %d, i: %i\0A\00"
@.str.1 = [8 x i8] c"N: %s \0A\00"
define void @insertionBitsTester(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* %5
%10 = call i8* @intToBaseString(i32 %9, i32 2)
%11 = load i32, i32* %6
%12 = call i8* @intToBaseString(i32 %11, i32 2)
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %10, i8* %12, i32 %13, i32 %14)
%16 = load i32, i32* %5
%17 = load i32, i32* %6
%18 = load i32, i32* %7
%19 = load i32, i32* %8
%20 = call i32 @insertBits(i32 %16, i32 %17, i32 %18, i32 %19)
%21 = call i8* @intToBaseString(i32 %20, i32 2)
%22 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %21)
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"N: %s, M: %s, j: %d, i: %i\0A\00"
@.str.1 = [8 x i8] c"N: %s \0A\00"
define void @insertionBitsTester(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i8* @intToBaseString(i32 %0, i32 2)
%6 = tail call i8* @intToBaseString(i32 %1, i32 2)
%7 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6, i32 %2, i32 %3)
%8 = tail call i32 @insertBits(i32 %0, i32 %1, i32 %2, i32 %3)
%9 = tail call i8* @intToBaseString(i32 %8, i32 2)
%10 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %9)
ret void
}