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

/* Variables and functions */
int invert(unsigned int, int, int);
int /*<<< orphan*/ printBits(int, ...);
int /*<<< orphan*/ printf(char *);
int main(void) {
  unsigned int x;
  int p, n;
  x = 85;
  p = 7;
  n = 3;
  int r = invert(x, p, n);
  printf("original: \n");
  printBits(sizeof(x), &x);
  printf("after invert: \n");
  printBits(sizeof(r), &r);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x55,-0x8(%rbp)
movl   $0x7,-0xc(%rbp)
movl   $0x3,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <invert@plt>
mov    %eax,-0x14(%rbp)
lea    0xe94(%rip),%rdi
call   1050 <printf@plt>
mov    $0x4,%edi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <printBits@plt>
lea    0xe84(%rip),%rdi
call   1050 <printf@plt>
mov    $0x4,%edi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <printBits@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x55,0x4(%rsp)
mov    $0x55,%edi
mov    $0x7,%esi
mov    $0x3,%edx
call   1030 <invert@plt>
mov    %eax,(%rsp)
lea    0xea9(%rip),%rdi
call   1040 <puts@plt>
lea    0x4(%rsp),%rsi
mov    $0x4,%edi
xor    %eax,%eax
call   1050 <printBits@plt>
lea    0xe97(%rip),%rdi
call   1040 <puts@plt>
mov    %rsp,%rsi
mov    $0x4,%edi
xor    %eax,%eax
call   1050 <printBits@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"original: \0A\00"
@.str.1 = [16 x i8] c"after invert: \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 85, i32* %2
store i32 7, i32* %3
store i32 3, i32* %4
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = call i32 @invert(i32 %6, i32 %7, i32 %8)
store i32 %9, i32* %5
%10 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i32, ...) @printBits(i32 4, i32* %2)
%12 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 (i32, ...) @printBits(i32 4, i32* %5)
ret i32 0
}

LLVM IR (-O2):
@str = [11 x i8] c"original: \00"
@str.2 = [15 x i8] c"after invert: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 85, i32* %1
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @invert(i32 85, i32 7, i32 3)
store i32 %5, i32* %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%7 = call i32 (i32, ...) @printBits(i32 4, i32* %1)
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.2, i64 0, i64 0))
%9 = call i32 (i32, ...) @printBits(i32 4, i32* %2)
ret i32 0
}