#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*/ dec2bin(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ setbits(int, int, int, int);
int main(void) {
  int x, y, p, n;
  x = 170;
  p = 4;
  n = 3;
  y = 15;
  printf("x = ");
  dec2bin(x);
  printf("p = ");
  dec2bin(p);
  printf("n = ");
  dec2bin(n);
  printf("y = ");
  dec2bin(y);
  printf("**Call to setbits\n");
  setbits(x, p, n, y);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xaa,-0x8(%rbp)
movl   $0x4,-0x10(%rbp)
movl   $0x3,-0x14(%rbp)
movl   $0xf,-0xc(%rbp)
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
call   1050 <dec2bin@plt>
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%edi
call   1050 <dec2bin@plt>
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
call   1050 <dec2bin@plt>
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%edi
call   1050 <dec2bin@plt>
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0xc(%rbp),%ecx
call   1040 <setbits@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeb8(%rip),%rdi
call   1040 <printf@plt>
mov    $0xaa,%edi
call   1060 <dec2bin@plt>
lea    0xea7(%rip),%rdi
call   1040 <printf@plt>
mov    $0x4,%edi
call   1060 <dec2bin@plt>
lea    0xe96(%rip),%rdi
call   1040 <printf@plt>
mov    $0x3,%edi
call   1060 <dec2bin@plt>
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
mov    $0xf,%edi
call   1060 <dec2bin@plt>
lea    0xe74(%rip),%rdi
call   1030 <puts@plt>
mov    $0xaa,%edi
mov    $0x4,%esi
mov    $0x3,%edx
mov    $0xf,%ecx
call   1050 <setbits@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"x = \00"
@.str.1 = [5 x i8] c"p = \00"
@.str.2 = [5 x i8] c"n = \00"
@.str.3 = [5 x i8] c"y = \00"
@.str.4 = [19 x i8] c"**Call to setbits\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 170, i32* %2
store i32 4, i32* %4
store i32 3, i32* %5
store i32 15, i32* %3
%6 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* %2
%8 = call i32 @dec2bin(i32 %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%10 = load i32, i32* %4
%11 = call i32 @dec2bin(i32 %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%13 = load i32, i32* %5
%14 = call i32 @dec2bin(i32 %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%16 = load i32, i32* %3
%17 = call i32 @dec2bin(i32 %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
%19 = load i32, i32* %2
%20 = load i32, i32* %4
%21 = load i32, i32* %5
%22 = load i32, i32* %3
%23 = call i32 @setbits(i32 %19, i32 %20, i32 %21, i32 %22)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"x = \00"
@.str.1 = [5 x i8] c"p = \00"
@.str.2 = [5 x i8] c"n = \00"
@.str.3 = [5 x i8] c"y = \00"
@str = [18 x i8] c"**Call to setbits\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @dec2bin(i32 170)
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @dec2bin(i32 4)
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @dec2bin(i32 3)
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%8 = tail call i32 @dec2bin(i32 15)
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 @setbits(i32 170, i32 4, i32 3, i32 15)
ret i32 0
}