#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*/ assert(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ set_bit(int, int *);
void set_bit_test() {
  printf("Testing set_bit_test...");
  int a[3] = {0x1f3, 0xc0000000, 0xffff1111};
  set_bit(2, (int *)&a);
  assert(a[0] == 0x1f7);
  set_bit(56, (int *)&a);
  assert(a[1] == 0xc1000000);
  printf("[OK]\n");
}


x86 assembly (clang, -O0):
<set_bit_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
mov    0xed5(%rip),%rax
mov    %rax,-0xc(%rbp)
mov    0xed3(%rip),%eax
mov    %eax,-0x4(%rbp)
lea    -0xc(%rbp),%rsi
mov    $0x2,%edi
call   1040 <set_bit@plt>
cmpl   $0x1f7,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0xc(%rbp),%rsi
mov    $0x38,%edi
call   1040 <set_bit@plt>
cmpl   $0xc1000000,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_bit_test>:
push   %rbx
sub    $0x10,%rsp
lea    0xeb4(%rip),%rdi
call   1040 <printf@plt>
mov    0xed1(%rip),%eax
mov    %eax,0x8(%rsp)
mov    0xebe(%rip),%rax
mov    %rax,(%rsp)
mov    %rsp,%rbx
mov    $0x2,%edi
mov    %rbx,%rsi
call   1050 <set_bit@plt>
xor    %edi,%edi
cmpl   $0x1f7,(%rsp)
sete   %dil
call   1060 <assert@plt>
mov    $0x38,%edi
mov    %rbx,%rsi
call   1050 <set_bit@plt>
xor    %edi,%edi
cmpl   $0xc1000000,0x4(%rsp)
c1
sete   %dil
call   1060 <assert@plt>
lea    0xe69(%rip),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Testing set_bit_test...\00"
@__const.set_bit_test.a = [3 x i32] [i32 499, i32 -1073741824, i32 -61167]
@.str.1 = [6 x i8] c"[OK]\0A\00"
define void @set_bit_test() {
%1 = alloca [3 x i32]
%2 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = bitcast [3 x i32]* %1 to i8*
%4 = bitcast [3 x i32]* %1 to i32*
%5 = call i32 @set_bit(i32 2, i32* %4)
%6 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%7 = load i32, i32* %6
%8 = icmp eq i32 %7, 503
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = bitcast [3 x i32]* %1 to i32*
%12 = call i32 @set_bit(i32 56, i32* %11)
%13 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
%14 = load i32, i32* %13
%15 = icmp eq i32 %14, -1056964608
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"Testing set_bit_test...\00"
@__const.set_bit_test.a = [3 x i32] [i32 499, i32 -1073741824, i32 -61167]
@str = [5 x i8] c"[OK]\00"
define void @set_bit_test() {
%1 = alloca [3 x i32]
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = bitcast [3 x i32]* %1 to i8*
%4 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%5 = call i32 @set_bit(i32 2, i32* %4)
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 503
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = call i32 @set_bit(i32 56, i32* %4)
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
%12 = load i32, i32* %11
%13 = icmp eq i32 %12, -1056964608
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret void
}