#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*/ clear_bit_val(int *, int);
int get_bit_val(int *, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ set_bit_val(int *, int);
int main() {
  int src = 0xabcdef;
  printf("%x\n", get_bit_val(&src, 10));
  set_bit_val(&src, 10);
  printf("set %x\n", src);
  clear_bit_val(&src, 10);
  printf("set %x\n", src);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xabcdef,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
mov    $0xa,%esi
call   1040 <get_bit_val@plt>
mov    %eax,%esi
lea    0xe97(%rip),%rdi
call   1050 <printf@plt>
lea    -0x8(%rbp),%rdi
mov    $0xa,%esi
call   1030 <set_bit_val@plt>
mov    -0x8(%rbp),%esi
lea    0xe76(%rip),%rdi
call   1050 <printf@plt>
lea    -0x8(%rbp),%rdi
mov    $0xa,%esi
call   1060 <clear_bit_val@plt>
mov    -0x8(%rbp),%esi
lea    0xe59(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movl   $0xabcdef,0x4(%rsp)
lea    0x4(%rsp),%r14
mov    %r14,%rdi
mov    $0xa,%esi
call   1040 <get_bit_val@plt>
lea    0xe9f(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    %r14,%rdi
mov    $0xa,%esi
call   1030 <set_bit_val@plt>
mov    0x4(%rsp),%esi
lea    0xe7c(%rip),%rbx
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %r14,%rdi
mov    $0xa,%esi
call   1060 <clear_bit_val@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%x\0A\00"
@.str.1 = [8 x i8] c"set %x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 11259375, i32* %2
%3 = call i32 @get_bit_val(i32* %2, i32 10)
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 @set_bit_val(i32* %2, i32 10)
%6 = load i32, i32* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = call i32 @clear_bit_val(i32* %2, i32 10)
%9 = load i32, i32* %2
%10 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%x\0A\00"
@.str.1 = [8 x i8] c"set %x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 11259375, i32* %1
%3 = call i32 @get_bit_val(i32* %1, i32 10)
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 @set_bit_val(i32* %1, i32 10)
%6 = load i32, i32* %1
%7 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = call i32 @clear_bit_val(i32* %1, i32 10)
%9 = load i32, i32* %1
%10 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %9)
ret i32 0
}