#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 uint8_t;

/* Variables and functions */
int /*<<< orphan*/ print_binary(int);
int /*<<< orphan*/ printf(char *, ...);
int setbits(int, int, int, int);
int main() {
  uint8_t post_x;
  post_x = 0;
  printf("\n\nx:\t\t");
  print_binary(0b10000010);
  printf("\ny:\t\t");
  print_binary(0b01100101);
  printf("\np: %d\nn: %d\n\n", 2, 3);
  post_x = setbits(0b10000010, 2, 3, 0b01100101);
  printf("result:\t\t");
  print_binary(post_x);
  printf("\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x82,%edi
call   1050 <print_binary@plt>
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x65,%edi
call   1050 <print_binary@plt>
lea    0xe90(%rip),%rdi
mov    $0x2,%esi
mov    $0x3,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x82,%edi
mov    $0x2,%esi
mov    $0x3,%edx
mov    $0x65,%ecx
call   1040 <setbits@plt>
mov    %eax,-0x8(%rbp)
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
call   1050 <print_binary@plt>
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xeb8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x82,%edi
call   1060 <print_binary@plt>
lea    0xea7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x65,%edi
call   1060 <print_binary@plt>
lea    0xe95(%rip),%rdi
mov    $0x2,%esi
mov    $0x3,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x82,%edi
mov    $0x2,%esi
mov    $0x3,%edx
mov    $0x65,%ecx
call   1050 <setbits@plt>
mov    %eax,%ebx
lea    0xe71(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%edi
call   1060 <print_binary@plt>
lea    0xe5a(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"\0A\0Ax:\09\09\00"
@.str.1 = [6 x i8] c"\0Ay:\09\09\00"
@.str.2 = [15 x i8] c"\0Ap: %d\0An: %d\0A\0A\00"
@.str.3 = [10 x i8] c"result:\09\09\00"
@.str.4 = [3 x i8] c"\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @print_binary(i32 130)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @print_binary(i32 101)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 2, i32 3)
%8 = call i32 @setbits(i32 130, i32 2, i32 3, i32 101)
store i32 %8, i32* %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%10 = load i32, i32* %2
%11 = call i32 @print_binary(i32 %10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"\0A\0Ax:\09\09\00"
@.str.1 = [6 x i8] c"\0Ay:\09\09\00"
@.str.2 = [15 x i8] c"\0Ap: %d\0An: %d\0A\0A\00"
@.str.3 = [10 x i8] c"result:\09\09\00"
@str = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @print_binary(i32 130)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @print_binary(i32 101)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 2, i32 3)
%6 = tail call i32 @setbits(i32 130, i32 2, i32 3, i32 101)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%8 = tail call i32 @print_binary(i32 %6)
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret i32 0
}