#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*/ ClearBit(int *, int);
int /*<<< orphan*/ SetBit(int *, int);
scalar_t__ TestBit(int *, int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int A[8];
  int i;
  for (i = 0; i < 8; i++)
    A[i] = 0;
  printf("Set bit poistions 100, 200 and 300\n");
  SetBit(A, 100);
  SetBit(A, 200);
  SetBit(A, 300);
  for (i = 0; i < 320; i++)
    if (TestBit(A, i))
      printf("Bit %d was set !\n", i);
  printf("\nClear bit poistions 200 \n");
  ClearBit(A, 200);
  for (i = 0; i < 320; i++)
    if (TestBit(A, i))
      printf("Bit %d was set !\n", i);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x8,-0x34(%rbp)
jge    1181 <main+0x41>
movslq -0x34(%rbp),%rax
movl   $0x0,-0x30(%rbp,%rax,4)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    115d <main+0x1d>
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x64,%esi
call   1050 <SetBit@plt>
lea    -0x30(%rbp),%rdi
mov    $0xc8,%esi
call   1050 <SetBit@plt>
lea    -0x30(%rbp),%rdi
mov    $0x12c,%esi
call   1050 <SetBit@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0x140,-0x34(%rbp)
jge    1207 <main+0xc7>
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1040 <TestBit@plt>
cmp    $0x0,%rax
je     11f4 <main+0xb4>
mov    -0x34(%rbp),%esi
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f9 <main+0xb9>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11c0 <main+0x80>
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0xc8,%esi
call   1060 <ClearBit@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0x140,-0x34(%rbp)
jge    1271 <main+0x131>
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1040 <TestBit@plt>
cmp    $0x0,%rax
je     125e <main+0x11e>
mov    -0x34(%rbp),%esi
lea    0xdcd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1263 <main+0x123>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    122a <main+0xea>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
lea    0xea7(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x64,%esi
call   1060 <SetBit@plt>
mov    %rbx,%rdi
mov    $0xc8,%esi
call   1060 <SetBit@plt>
mov    %rbx,%rdi
mov    $0x12c,%esi
call   1060 <SetBit@plt>
lea    0xe5f(%rip),%r14
xor    %ebp,%ebp
jmp    11bb <main+0x6b>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebp
cmp    $0x140,%ebp
je     11d8 <main+0x88>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1050 <TestBit@plt>
test   %rax,%rax
je     11b0 <main+0x60>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11b0 <main+0x60>
lea    0xe56(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xc8,%esi
call   1070 <ClearBit@plt>
lea    0xe05(%rip),%r14
xor    %ebp,%ebp
jmp    120b <main+0xbb>
nop
add    $0x1,%ebp
cmp    $0x140,%ebp
je     1228 <main+0xd8>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1050 <TestBit@plt>
test   %rax,%rax
je     1200 <main+0xb0>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1200 <main+0xb0>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [36 x i8] c"Set bit poistions 100, 200 and 300\0A\00"
@.str.1 = [18 x i8] c"Bit %d was set !\0A\00"
@.str.2 = [27 x i8] c"\0AClear bit poistions 200 \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [8 x i32]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
br label %8
8: ; preds = %15, %2
%9 = load i32, i32* %7
%10 = icmp slt i32 %9, 8
br i1 %10, label %11, label %18
11: ; preds = %8
%12 = load i32, i32* %7
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 %13
store i32 0, i32* %14
br label %15
15: ; preds = %11
%16 = load i32, i32* %7
%17 = add nsw i32 %16, 1
store i32 %17, i32* %7
br label %8
18: ; preds = %8
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%20 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 0
%21 = call i32 @SetBit(i32* %20, i32 100)
%22 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 0
%23 = call i32 @SetBit(i32* %22, i32 200)
%24 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 0
%25 = call i32 @SetBit(i32* %24, i32 300)
store i32 0, i32* %7
br label %26
26: ; preds = %38, %18
%27 = load i32, i32* %7
%28 = icmp slt i32 %27, 320
br i1 %28, label %29, label %41
29: ; preds = %26
%30 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 0
%31 = load i32, i32* %7
%32 = call i64 @TestBit(i32* %30, i32 %31)
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %29
%35 = load i32, i32* %7
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %35)
br label %37
37: ; preds = %34, %29
br label %38
38: ; preds = %37
%39 = load i32, i32* %7
%40 = add nsw i32 %39, 1
store i32 %40, i32* %7
br label %26
41: ; preds = %26
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%43 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 0
%44 = call i32 @ClearBit(i32* %43, i32 200)
store i32 0, i32* %7
br label %45
45: ; preds = %57, %41
%46 = load i32, i32* %7
%47 = icmp slt i32 %46, 320
br i1 %47, label %48, label %60
48: ; preds = %45
%49 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 0
%50 = load i32, i32* %7
%51 = call i64 @TestBit(i32* %49, i32 %50)
%52 = icmp ne i64 %51, 0
br i1 %52, label %53, label %56
53: ; preds = %48
%54 = load i32, i32* %7
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %54)
br label %56
56: ; preds = %53, %48
br label %57
57: ; preds = %56
%58 = load i32, i32* %7
%59 = add nsw i32 %58, 1
store i32 %59, i32* %7
br label %45
60: ; preds = %45
%61 = load i32, i32* %3
ret i32 %61
}

LLVM IR (-O2):
@.str.1 = [18 x i8] c"Bit %d was set !\0A\00"
@str = [35 x i8] c"Set bit poistions 100, 200 and 300\00"
@str.3 = [26 x i8] c"\0AClear bit poistions 200 \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [8 x i32]
%4 = bitcast [8 x i32]* %3 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%6 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 0
%7 = call i32 @SetBit(i32* %6, i32 100)
%8 = call i32 @SetBit(i32* %6, i32 200)
%9 = call i32 @SetBit(i32* %6, i32 300)
br label %10
10: ; preds = %2, %16
%11 = phi i32 [ 0, %2 ], [ %17, %16 ]
%12 = call i64 @TestBit(i32* %6, i32 %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %10
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %11)
br label %16
16: ; preds = %10, %14
%17 = add nuw nsw i32 %11, 1
%18 = icmp eq i32 %17, 320
br i1 %18, label %19, label %10
19: ; preds = %16
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.3, i64 0, i64 0))
%21 = call i32 @ClearBit(i32* %6, i32 200)
br label %22
22: ; preds = %19, %28
%23 = phi i32 [ 0, %19 ], [ %29, %28 ]
%24 = call i64 @TestBit(i32* %6, i32 %23)
%25 = icmp eq i64 %24, 0
br i1 %25, label %28, label %26
26: ; preds = %22
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %23)
br label %28
28: ; preds = %22, %26
%29 = add nuw nsw i32 %23, 1
%30 = icmp eq i32 %29, 320
br i1 %30, label %31, label %22
31: ; preds = %28
ret i32 0
}