#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 bitValue(char *, int);
scalar_t__ bt(char *, int);
int btc(char *, int);
int btr(char *, int);
scalar_t__ bts(char *, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
int main() {
  char buffer[128];
  int i;
  int bitNo;
  int errors = 0;
  for (i = 0; i < 128; i++) {
    buffer[i] = (char)-1;
  }
  for (bitNo = 128 * 8 - 1; bitNo >= 0; bitNo -= 63) {
    int res = btc(&buffer[0], bitNo);
    if (res & 2) {
      fprintf(stderr, "Bit index register corrupted by btc\n");
      errors++;
    }
    if (res & 1) {
      if (bitValue(&buffer[0], bitNo) != 0) {
        fprintf(stderr, "Bit %d not cleared by btc\n", bitNo);
        errors++;
      }
    } else {
      errors++;
      fprintf(stderr, "Bit %d not seen as set by btc\n", bitNo);
    }
  }
  for (bitNo = 128 * 8 - 1; bitNo >= 0; bitNo -= 63) {
    if (bts(&buffer[0], bitNo) == 0) {
      if (bitValue(&buffer[0], bitNo) != 1) {
        fprintf(stderr, "Bit %d not set by bts\n", bitNo);
        errors++;
      }
    } else {
      errors++;
      fprintf(stderr, "Bit %d not seen as clear by bts\n", bitNo);
    }
  }
  for (bitNo = 128 * 8 - 1; bitNo >= 0; bitNo -= 63) {
    if (btr(&buffer[0], bitNo) == 1) {
      if (bitValue(&buffer[0], bitNo) != 0) {
        fprintf(stderr, "Bit %d not cleared by btr\n", bitNo);
        errors++;
      }
    } else {
      errors++;
      fprintf(stderr, "Bit %d not seen as set by btr\n", bitNo);
    }
  }
  for (bitNo = 128 * 8 - 1; bitNo >= 0; bitNo -= 63) {
    if (bt(&buffer[0], bitNo) != 0) {
      errors++;
      fprintf(stderr, "Bit %d not seen as clear by bt\n", bitNo);
    }
  }
  if (errors == 0) {
    fprintf(stderr, "All OK\n");
    return 0;
  } else {
    fprintf(stderr, "%d errors\n", errors);
    return errors;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x9c(%rbp)
movl   $0x0,-0x94(%rbp)
cmpl   $0x80,-0x94(%rbp)
jge    11b9 <main+0x59>
movslq -0x94(%rbp),%rax
movb   $0xff,-0x90(%rbp,%rax,1)
ff
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    1186 <main+0x26>
movl   $0x3ff,-0x98(%rbp)
cmpl   $0x0,-0x98(%rbp)
jl     12c3 <main+0x163>
lea    -0x90(%rbp),%rdi
mov    -0x98(%rbp),%esi
call   1060 <btc@plt>
mov    %eax,-0xa0(%rbp)
mov    -0xa0(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     1220 <main+0xc0>
mov    0x2ddf(%rip),%rax
mov    (%rax),%edi
lea    0xdf6(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x9c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c(%rbp)
mov    -0xa0(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     127e <main+0x11e>
lea    -0x90(%rbp),%rdi
mov    -0x98(%rbp),%esi
call   1040 <bitValue@plt>
cmp    $0x0,%eax
je     1279 <main+0x119>
mov    0x2d8c(%rip),%rax
mov    (%rax),%edi
mov    -0x98(%rbp),%edx
lea    0xdc2(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x9c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c(%rbp)
jmp    12aa <main+0x14a>
mov    -0x9c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c(%rbp)
mov    0x2d4c(%rip),%rax
mov    (%rax),%edi
mov    -0x98(%rbp),%edx
lea    0xd9d(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    12af <main+0x14f>
mov    -0x98(%rbp),%eax
sub    $0x3f,%eax
mov    %eax,-0x98(%rbp)
jmp    11c3 <main+0x63>
movl   $0x3ff,-0x98(%rbp)
cmpl   $0x0,-0x98(%rbp)
jl     1387 <main+0x227>
lea    -0x90(%rbp),%rdi
mov    -0x98(%rbp),%esi
call   1070 <bts@plt>
cmp    $0x0,%rax
jne    1342 <main+0x1e2>
lea    -0x90(%rbp),%rdi
mov    -0x98(%rbp),%esi
call   1040 <bitValue@plt>
cmp    $0x1,%eax
je     133d <main+0x1dd>
mov    0x2cc8(%rip),%rax
mov    (%rax),%edi
mov    -0x98(%rbp),%edx
lea    0xd38(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x9c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c(%rbp)
jmp    136e <main+0x20e>
mov    -0x9c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c(%rbp)
mov    0x2c88(%rip),%rax
mov    (%rax),%edi
mov    -0x98(%rbp),%edx
lea    0xd0f(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1373 <main+0x213>
mov    -0x98(%rbp),%eax
sub    $0x3f,%eax
mov    %eax,-0x98(%rbp)
jmp    12cd <main+0x16d>
movl   $0x3ff,-0x98(%rbp)
cmpl   $0x0,-0x98(%rbp)
jl     144a <main+0x2ea>
lea    -0x90(%rbp),%rdi
mov    -0x98(%rbp),%esi
call   1030 <btr@plt>
cmp    $0x1,%eax
jne    1405 <main+0x2a5>
lea    -0x90(%rbp),%rdi
mov    -0x98(%rbp),%esi
call   1040 <bitValue@plt>
cmp    $0x0,%eax
je     1400 <main+0x2a0>
mov    0x2c05(%rip),%rax
mov    (%rax),%edi
mov    -0x98(%rbp),%edx
lea    0xcad(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x9c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c(%rbp)
jmp    1431 <main+0x2d1>
mov    -0x9c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c(%rbp)
mov    0x2bc5(%rip),%rax
mov    (%rax),%edi
mov    -0x98(%rbp),%edx
lea    0xc88(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1436 <main+0x2d6>
mov    -0x98(%rbp),%eax
sub    $0x3f,%eax
mov    %eax,-0x98(%rbp)
jmp    1391 <main+0x231>
movl   $0x3ff,-0x98(%rbp)
cmpl   $0x0,-0x98(%rbp)
jl     14c2 <main+0x362>
lea    -0x90(%rbp),%rdi
mov    -0x98(%rbp),%esi
call   1080 <bt@plt>
cmp    $0x0,%rax
je     14a9 <main+0x349>
mov    -0x9c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c(%rbp)
mov    0x2b4d(%rip),%rax
mov    (%rax),%edi
mov    -0x98(%rbp),%edx
lea    0xc2f(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    14ae <main+0x34e>
mov    -0x98(%rbp),%eax
sub    $0x3f,%eax
mov    %eax,-0x98(%rbp)
jmp    1454 <main+0x2f4>
cmpl   $0x0,-0x9c(%rbp)
jne    14f2 <main+0x392>
mov    0x2b0a(%rip),%rax
mov    (%rax),%edi
lea    0xc12(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1518 <main+0x3b8>
mov    0x2ae7(%rip),%rax
mov    (%rax),%edi
mov    -0x9c(%rbp),%edx
lea    0xbf1(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x9c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
pcmpeqd %xmm0,%xmm0
movdqa %xmm0,0x70(%rsp)
movdqa %xmm0,0x60(%rsp)
movdqa %xmm0,0x50(%rsp)
movdqa %xmm0,0x40(%rsp)
movdqa %xmm0,0x30(%rsp)
movdqa %xmm0,0x20(%rsp)
movdqa %xmm0,0x10(%rsp)
movdqa %xmm0,(%rsp)
mov    $0x43e,%ebp
mov    %rsp,%r14
mov    0x2e2d(%rip),%r13
lea    0xe46(%rip),%r15
xor    %ebx,%ebx
jmp    11dc <main+0x7c>
xchg   %ax,%ax
add    $0x1,%ebx
mov    0x0(%r13),%edi
lea    0xe72(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
cmp    $0x3e,%ebp
jbe    1230 <main+0xd0>
add    $0xffffffc1,%ebp
mov    %r14,%rdi
mov    %ebp,%esi
call   1060 <btc@plt>
mov    %eax,%r12d
test   $0x2,%r12b
je     1203 <main+0xa3>
mov    0x0(%r13),%edi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
add    $0x1,%ebx
test   $0x1,%r12b
je     11c0 <main+0x60>
mov    %r14,%rdi
mov    %ebp,%esi
call   1040 <bitValue@plt>
test   %eax,%eax
je     11d7 <main+0x77>
mov    0x0(%r13),%edi
lea    0xe03(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
add    $0x1,%ebx
jmp    11d7 <main+0x77>
mov    $0x43e,%ebp
mov    %rsp,%r14
lea    0xe20(%rip),%r15
lea    0xe30(%rip),%r12
jmp    1268 <main+0x108>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebx
mov    0x0(%r13),%edi
mov    %r12,%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
cmp    $0x3e,%ebp
jbe    129e <main+0x13e>
add    $0xffffffc1,%ebp
mov    %r14,%rdi
mov    %ebp,%esi
call   1070 <bts@plt>
test   %rax,%rax
jne    1250 <main+0xf0>
mov    %r14,%rdi
mov    %ebp,%esi
call   1040 <bitValue@plt>
cmp    $0x1,%eax
je     1263 <main+0x103>
mov    0x0(%r13),%edi
mov    %r15,%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
add    $0x1,%ebx
jmp    1263 <main+0x103>
mov    $0x43e,%ebp
mov    %rsp,%r14
lea    0xdea(%rip),%r15
lea    0xdfe(%rip),%r12
jmp    12d8 <main+0x178>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%ebx
mov    0x0(%r13),%edi
mov    %r12,%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
cmp    $0x3e,%ebp
jbe    130d <main+0x1ad>
add    $0xffffffc1,%ebp
mov    %r14,%rdi
mov    %ebp,%esi
call   1030 <btr@plt>
cmp    $0x1,%eax
jne    12c0 <main+0x160>
mov    %r14,%rdi
mov    %ebp,%esi
call   1040 <bitValue@plt>
test   %eax,%eax
je     12d3 <main+0x173>
mov    0x0(%r13),%edi
mov    %r15,%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
add    $0x1,%ebx
jmp    12d3 <main+0x173>
mov    $0x43e,%ebp
mov    %rsp,%r14
lea    0xdb5(%rip),%r15
jmp    1325 <main+0x1c5>
xchg   %ax,%ax
cmp    $0x3e,%ebp
jbe    134c <main+0x1ec>
add    $0xffffffc1,%ebp
mov    %r14,%rdi
mov    %ebp,%esi
call   1080 <bt@plt>
test   %rax,%rax
je     1320 <main+0x1c0>
add    $0x1,%ebx
mov    0x0(%r13),%edi
mov    %r15,%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    1320 <main+0x1c0>
mov    0x0(%r13),%edi
test   %ebx,%ebx
je     1366 <main+0x206>
lea    0xd9e(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    1374 <main+0x214>
lea    0xd84(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    %ebx,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [37 x i8] c"Bit index register corrupted by btc\0A\00"
@.str.1 = [27 x i8] c"Bit %d not cleared by btc\0A\00"
@.str.2 = [31 x i8] c"Bit %d not seen as set by btc\0A\00"
@.str.3 = [23 x i8] c"Bit %d not set by bts\0A\00"
@.str.4 = [33 x i8] c"Bit %d not seen as clear by bts\0A\00"
@.str.5 = [27 x i8] c"Bit %d not cleared by btr\0A\00"
@.str.6 = [31 x i8] c"Bit %d not seen as set by btr\0A\00"
@.str.7 = [32 x i8] c"Bit %d not seen as clear by bt\0A\00"
@.str.8 = [8 x i8] c"All OK\0A\00"
@.str.9 = [11 x i8] c"%d errors\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [128 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
store i32 0, i32* %3
br label %7
7: ; preds = %14, %0
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 128
br i1 %9, label %10, label %17
10: ; preds = %7
%11 = load i32, i32* %3
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 %12
store i8 -1, i8* %13
br label %14
14: ; preds = %10
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %7
17: ; preds = %7
store i32 1023, i32* %4
br label %18
18: ; preds = %56, %17
%19 = load i32, i32* %4
%20 = icmp sge i32 %19, 0
br i1 %20, label %21, label %59
21: ; preds = %18
%22 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%23 = load i32, i32* %4
%24 = call i32 @btc(i8* %22, i32 %23)
store i32 %24, i32* %6
%25 = load i32, i32* %6
%26 = and i32 %25, 2
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %33
28: ; preds = %21
%29 = load i32, i32* @stderr
%30 = call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
store i32 %32, i32* %5
br label %33
33: ; preds = %28, %21
%34 = load i32, i32* %6
%35 = and i32 %34, 1
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %49
37: ; preds = %33
%38 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%39 = load i32, i32* %4
%40 = call i32 @bitValue(i8* %38, i32 %39)
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %48
42: ; preds = %37
%43 = load i32, i32* @stderr
%44 = load i32, i32* %4
%45 = call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %44)
%46 = load i32, i32* %5
%47 = add nsw i32 %46, 1
store i32 %47, i32* %5
br label %48
48: ; preds = %42, %37
br label %55
49: ; preds = %33
%50 = load i32, i32* %5
%51 = add nsw i32 %50, 1
store i32 %51, i32* %5
%52 = load i32, i32* @stderr
%53 = load i32, i32* %4
%54 = call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %53)
br label %55
55: ; preds = %49, %48
br label %56
56: ; preds = %55
%57 = load i32, i32* %4
%58 = sub nsw i32 %57, 63
store i32 %58, i32* %4
br label %18
59: ; preds = %18
store i32 1023, i32* %4
br label %60
60: ; preds = %87, %59
%61 = load i32, i32* %4
%62 = icmp sge i32 %61, 0
br i1 %62, label %63, label %90
63: ; preds = %60
%64 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%65 = load i32, i32* %4
%66 = call i64 @bts(i8* %64, i32 %65)
%67 = icmp eq i64 %66, 0
br i1 %67, label %68, label %80
68: ; preds = %63
%69 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%70 = load i32, i32* %4
%71 = call i32 @bitValue(i8* %69, i32 %70)
%72 = icmp ne i32 %71, 1
br i1 %72, label %73, label %79
73: ; preds = %68
%74 = load i32, i32* @stderr
%75 = load i32, i32* %4
%76 = call i32 (i32, i8*, ...) @fprintf(i32 %74, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %75)
%77 = load i32, i32* %5
%78 = add nsw i32 %77, 1
store i32 %78, i32* %5
br label %79
79: ; preds = %73, %68
br label %86
80: ; preds = %63
%81 = load i32, i32* %5
%82 = add nsw i32 %81, 1
store i32 %82, i32* %5
%83 = load i32, i32* @stderr
%84 = load i32, i32* %4
%85 = call i32 (i32, i8*, ...) @fprintf(i32 %83, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i32 %84)
br label %86
86: ; preds = %80, %79
br label %87
87: ; preds = %86
%88 = load i32, i32* %4
%89 = sub nsw i32 %88, 63
store i32 %89, i32* %4
br label %60
90: ; preds = %60
store i32 1023, i32* %4
br label %91
91: ; preds = %118, %90
%92 = load i32, i32* %4
%93 = icmp sge i32 %92, 0
br i1 %93, label %94, label %121
94: ; preds = %91
%95 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%96 = load i32, i32* %4
%97 = call i32 @btr(i8* %95, i32 %96)
%98 = icmp eq i32 %97, 1
br i1 %98, label %99, label %111
99: ; preds = %94
%100 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%101 = load i32, i32* %4
%102 = call i32 @bitValue(i8* %100, i32 %101)
%103 = icmp ne i32 %102, 0
br i1 %103, label %104, label %110
104: ; preds = %99
%105 = load i32, i32* @stderr
%106 = load i32, i32* %4
%107 = call i32 (i32, i8*, ...) @fprintf(i32 %105, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i32 %106)
%108 = load i32, i32* %5
%109 = add nsw i32 %108, 1
store i32 %109, i32* %5
br label %110
110: ; preds = %104, %99
br label %117
111: ; preds = %94
%112 = load i32, i32* %5
%113 = add nsw i32 %112, 1
store i32 %113, i32* %5
%114 = load i32, i32* @stderr
%115 = load i32, i32* %4
%116 = call i32 (i32, i8*, ...) @fprintf(i32 %114, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), i32 %115)
br label %117
117: ; preds = %111, %110
br label %118
118: ; preds = %117
%119 = load i32, i32* %4
%120 = sub nsw i32 %119, 63
store i32 %120, i32* %4
br label %91
121: ; preds = %91
store i32 1023, i32* %4
br label %122
122: ; preds = %137, %121
%123 = load i32, i32* %4
%124 = icmp sge i32 %123, 0
br i1 %124, label %125, label %140
125: ; preds = %122
%126 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%127 = load i32, i32* %4
%128 = call i64 @bt(i8* %126, i32 %127)
%129 = icmp ne i64 %128, 0
br i1 %129, label %130, label %136
130: ; preds = %125
%131 = load i32, i32* %5
%132 = add nsw i32 %131, 1
store i32 %132, i32* %5
%133 = load i32, i32* @stderr
%134 = load i32, i32* %4
%135 = call i32 (i32, i8*, ...) @fprintf(i32 %133, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), i32 %134)
br label %136
136: ; preds = %130, %125
br label %137
137: ; preds = %136
%138 = load i32, i32* %4
%139 = sub nsw i32 %138, 63
store i32 %139, i32* %4
br label %122
140: ; preds = %122
%141 = load i32, i32* %5
%142 = icmp eq i32 %141, 0
br i1 %142, label %143, label %146
143: ; preds = %140
%144 = load i32, i32* @stderr
%145 = call i32 (i32, i8*, ...) @fprintf(i32 %144, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %1
br label %151
146: ; preds = %140
%147 = load i32, i32* @stderr
%148 = load i32, i32* %5
%149 = call i32 (i32, i8*, ...) @fprintf(i32 %147, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0), i32 %148)
%150 = load i32, i32* %5
store i32 %150, i32* %1
br label %151
151: ; preds = %146, %143
%152 = load i32, i32* %1
ret i32 %152
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [37 x i8] c"Bit index register corrupted by btc\0A\00"
@.str.1 = [27 x i8] c"Bit %d not cleared by btc\0A\00"
@.str.2 = [31 x i8] c"Bit %d not seen as set by btc\0A\00"
@.str.3 = [23 x i8] c"Bit %d not set by bts\0A\00"
@.str.4 = [33 x i8] c"Bit %d not seen as clear by bts\0A\00"
@.str.5 = [27 x i8] c"Bit %d not cleared by btr\0A\00"
@.str.6 = [31 x i8] c"Bit %d not seen as set by btr\0A\00"
@.str.7 = [32 x i8] c"Bit %d not seen as clear by bt\0A\00"
@.str.8 = [8 x i8] c"All OK\0A\00"
@.str.9 = [11 x i8] c"%d errors\0A\00"
define i32 @main() {
%1 = alloca [128 x i8]
%2 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%3 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
br label %4
4: ; preds = %0, %29
%5 = phi i32 [ %30, %29 ], [ 0, %0 ]
%6 = phi i32 [ %31, %29 ], [ 1023, %0 ]
%7 = call i32 @btc(i8* %3, i32 %6)
%8 = and i32 %7, 2
%9 = icmp eq i32 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %4
%11 = load i32, i32* @stderr
%12 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%13 = add nsw i32 %5, 1
br label %14
14: ; preds = %10, %4
%15 = phi i32 [ %13, %10 ], [ %5, %4 ]
%16 = and i32 %7, 1
%17 = icmp eq i32 %16, 0
br i1 %17, label %25, label %18
18: ; preds = %14
%19 = call i32 @bitValue(i8* %3, i32 %6)
%20 = icmp eq i32 %19, 0
br i1 %20, label %29, label %21
21: ; preds = %18
%22 = load i32, i32* @stderr
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%24 = add nsw i32 %15, 1
br label %29
25: ; preds = %14
%26 = add nsw i32 %15, 1
%27 = load i32, i32* @stderr
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %6)
br label %29
29: ; preds = %18, %21, %25
%30 = phi i32 [ %24, %21 ], [ %15, %18 ], [ %26, %25 ]
%31 = add nsw i32 %6, -63
%32 = icmp ugt i32 %6, 62
br i1 %32, label %4, label %33
33: ; preds = %29, %49
%34 = phi i32 [ %50, %49 ], [ %30, %29 ]
%35 = phi i32 [ %51, %49 ], [ 1023, %29 ]
%36 = call i64 @bts(i8* %3, i32 %35)
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %45
38: ; preds = %33
%39 = call i32 @bitValue(i8* %3, i32 %35)
%40 = icmp eq i32 %39, 1
br i1 %40, label %49, label %41
41: ; preds = %38
%42 = load i32, i32* @stderr
%43 = call i32 (i32, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %35)
%44 = add nsw i32 %34, 1
br label %49
45: ; preds = %33
%46 = add nsw i32 %34, 1
%47 = load i32, i32* @stderr
%48 = call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i32 %35)
br label %49
49: ; preds = %45, %41, %38
%50 = phi i32 [ %44, %41 ], [ %34, %38 ], [ %46, %45 ]
%51 = add nsw i32 %35, -63
%52 = icmp ugt i32 %35, 62
br i1 %52, label %33, label %53
53: ; preds = %49, %69
%54 = phi i32 [ %70, %69 ], [ %50, %49 ]
%55 = phi i32 [ %71, %69 ], [ 1023, %49 ]
%56 = call i32 @btr(i8* %3, i32 %55)
%57 = icmp eq i32 %56, 1
br i1 %57, label %58, label %65
58: ; preds = %53
%59 = call i32 @bitValue(i8* %3, i32 %55)
%60 = icmp eq i32 %59, 0
br i1 %60, label %69, label %61
61: ; preds = %58
%62 = load i32, i32* @stderr
%63 = call i32 (i32, i8*, ...) @fprintf(i32 %62, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i32 %55)
%64 = add nsw i32 %54, 1
br label %69
65: ; preds = %53
%66 = add nsw i32 %54, 1
%67 = load i32, i32* @stderr
%68 = call i32 (i32, i8*, ...) @fprintf(i32 %67, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), i32 %55)
br label %69
69: ; preds = %65, %61, %58
%70 = phi i32 [ %64, %61 ], [ %54, %58 ], [ %66, %65 ]
%71 = add nsw i32 %55, -63
%72 = icmp ugt i32 %55, 62
br i1 %72, label %53, label %73
73: ; preds = %69, %82
%74 = phi i32 [ %83, %82 ], [ %70, %69 ]
%75 = phi i32 [ %84, %82 ], [ 1023, %69 ]
%76 = call i64 @bt(i8* %3, i32 %75)
%77 = icmp eq i64 %76, 0
br i1 %77, label %82, label %78
78: ; preds = %73
%79 = add nsw i32 %74, 1
%80 = load i32, i32* @stderr
%81 = call i32 (i32, i8*, ...) @fprintf(i32 %80, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), i32 %75)
br label %82
82: ; preds = %73, %78
%83 = phi i32 [ %79, %78 ], [ %74, %73 ]
%84 = add nsw i32 %75, -63
%85 = icmp ugt i32 %75, 62
br i1 %85, label %73, label %86
86: ; preds = %82
%87 = icmp eq i32 %83, 0
%88 = load i32, i32* @stderr
br i1 %87, label %89, label %91
89: ; preds = %86
%90 = call i32 (i32, i8*, ...) @fprintf(i32 %88, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
br label %93
91: ; preds = %86
%92 = call i32 (i32, i8*, ...) @fprintf(i32 %88, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0), i32 %83)
br label %93
93: ; preds = %91, %89
ret i32 %83
}