#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*/ printBits(unsigned int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ setBitAt(unsigned int *, int, int);
void test2() {
  unsigned int a = 9;
  printf("a:\n");
  printBits(a);
  setBitAt(&a, 10, 1);
  printf("a after setBitAt(&a,10,1):\n");
  printBits(a);
  setBitAt(&a, 20, 1);
  printf("a after setBitAt(&a,20,1):\n");
  printBits(a);
  setBitAt(&a, 0, 0);
  printf("a after setBitAt(&a,0,0):\n");
  printBits(a);
  setBitAt(&a, 3, 0);
  printf("a after setBitAt(&a,3,0):\n");
  printBits(a);
}


x86 assembly (clang, -O0):
<test2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x9,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
call   1030 <printBits@plt>
lea    -0x4(%rbp),%rdi
mov    $0xa,%esi
mov    $0x1,%edx
call   1050 <setBitAt@plt>
lea    0xe97(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
call   1030 <printBits@plt>
lea    -0x4(%rbp),%rdi
mov    $0x14,%esi
mov    $0x1,%edx
call   1050 <setBitAt@plt>
lea    0xe8c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
call   1030 <printBits@plt>
lea    -0x4(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1050 <setBitAt@plt>
lea    0xe87(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
call   1030 <printBits@plt>
lea    -0x4(%rbp),%rdi
mov    $0x3,%esi
xor    %edx,%edx
call   1050 <setBitAt@plt>
lea    0xe7e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
call   1030 <printBits@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test2>:
push   %rbx
sub    $0x10,%rsp
movl   $0x9,0xc(%rsp)
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
mov    $0x9,%edi
call   1040 <printBits@plt>
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0x1,%edx
call   1050 <setBitAt@plt>
lea    0xe92(%rip),%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%edi
call   1040 <printBits@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
mov    $0x1,%edx
call   1050 <setBitAt@plt>
lea    0xe86(%rip),%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%edi
call   1040 <printBits@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <setBitAt@plt>
lea    0xe80(%rip),%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%edi
call   1040 <printBits@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %edx,%edx
call   1050 <setBitAt@plt>
lea    0xe76(%rip),%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%edi
call   1040 <printBits@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"a:\0A\00"
@.str.1 = [28 x i8] c"a after setBitAt(&a,10,1):\0A\00"
@.str.2 = [28 x i8] c"a after setBitAt(&a,20,1):\0A\00"
@.str.3 = [27 x i8] c"a after setBitAt(&a,0,0):\0A\00"
@.str.4 = [27 x i8] c"a after setBitAt(&a,3,0):\0A\00"
define void @test2() {
%1 = alloca i32
store i32 9, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
%4 = call i32 @printBits(i32 %3)
%5 = call i32 @setBitAt(i32* %1, i32 10, i32 1)
%6 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32, i32* %1
%8 = call i32 @printBits(i32 %7)
%9 = call i32 @setBitAt(i32* %1, i32 20, i32 1)
%10 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%11 = load i32, i32* %1
%12 = call i32 @printBits(i32 %11)
%13 = call i32 @setBitAt(i32* %1, i32 0, i32 0)
%14 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%15 = load i32, i32* %1
%16 = call i32 @printBits(i32 %15)
%17 = call i32 @setBitAt(i32* %1, i32 3, i32 0)
%18 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%19 = load i32, i32* %1
%20 = call i32 @printBits(i32 %19)
ret void
}

LLVM IR (-O2):
@str = [3 x i8] c"a:\00"
@str.5 = [27 x i8] c"a after setBitAt(&a,10,1):\00"
@str.6 = [27 x i8] c"a after setBitAt(&a,20,1):\00"
@str.7 = [26 x i8] c"a after setBitAt(&a,0,0):\00"
@str.8 = [26 x i8] c"a after setBitAt(&a,3,0):\00"
define void @test2() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 9, i32* %1
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @printBits(i32 9)
%5 = call i32 @setBitAt(i32* %1, i32 10, i32 1)
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.5, i64 0, i64 0))
%7 = load i32, i32* %1
%8 = call i32 @printBits(i32 %7)
%9 = call i32 @setBitAt(i32* %1, i32 20, i32 1)
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.6, i64 0, i64 0))
%11 = load i32, i32* %1
%12 = call i32 @printBits(i32 %11)
%13 = call i32 @setBitAt(i32* %1, i32 0, i32 0)
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.7, i64 0, i64 0))
%15 = load i32, i32* %1
%16 = call i32 @printBits(i32 %15)
%17 = call i32 @setBitAt(i32* %1, i32 3, i32 0)
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.8, i64 0, i64 0))
%19 = load i32, i32* %1
%20 = call i32 @printBits(i32 %19)
ret void
}