#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 */
unsigned int clearbit(unsigned int, int);
unsigned int clearbits_lsb(unsigned int, int);
unsigned int clearbits_msb(unsigned int, int);
int getbit(unsigned int, int);
int /*<<< orphan*/ printf(char *, ...);
unsigned int setbit(unsigned int, int);
unsigned int togglebit(unsigned int, int);
unsigned int updatebit(unsigned int, int, int);
unsigned int updatebit_c(unsigned int, int, int);
int main() {
  int c;
  unsigned int x = 15;
  printf("x = %d (1111)\n\n", 15);
  printf("XOR\n");
  printf("x ^ 0 = %d   (x)\n", x ^ 0);
  printf("x ^ 1 = %d   ~(x)\n", x ^ 15);
  printf("x ^ x = %d    (0)\n\n", x ^ x);
  printf("AND\n");
  printf("x & 0 = %d    (0)\n", x & 0);
  printf("x & 1 = %d   (x)\n", x & 15);
  printf("x & x = %d   (x)\n\n", x & x);
  printf("OR\n");
  printf("x | 0 = %d   (x)\n", x | 0);
  printf("x | 1 = %d   (1)\n", x | 15);
  printf("x | x = %d   (x)\n\n", x | x);
  printf("NOT\n");
  printf("~x = %d     ~(x)\n", ~x);
  for (c = 3; c >= 0; --c)
    printf("get %d bit: %d\n", c, getbit(~x, c));
  printf("\n\n");
  printf("x = %d (1010)\n", x = 10);
  for (c = 3; c >= 0; --c)
    printf("get %d bit: %d\n", c, getbit(x, c));
  printf("\n");
  printf("set bit %d to 1: %d\n", 2, x = setbit(x, 2));
  for (c = 3; c >= 0; --c)
    printf("get %d bit: %d\n", c, getbit(x, c));
  printf("\n");
  printf("clear bit %d to 0: %d\n", 3, x = clearbit(x, 3));
  for (c = 3; c >= 0; --c)
    printf("get %d bit: %d\n", c, getbit(x, c));
  printf("\n");
  printf("x = %d (1111)\n", x = 15);
  printf("clear most significant bits through bit %d: %d\n", 2,
         x = clearbits_msb(x, 2));
  for (c = 3; c >= 0; --c)
    printf("get %d bit: %d\n", c, getbit(x, c));
  printf("\n");
  printf("x = %d (1111)\n", x = 15);
  printf("clear least significant bits through bit %d: %d\n", 1,
         x = clearbits_lsb(x, 1));
  for (c = 3; c >= 0; --c)
    printf("get %d bit: %d\n", c, getbit(x, c));
  printf("\n");
  printf("x = %d (1111)\n", x = 15);
  printf("update bit %d to 0: %d\n", 2, x = updatebit(x, 2, 0));
  printf("update bit %d to 1: %d\n", 3, x = updatebit(x, 3, 1));
  for (c = 3; c >= 0; --c)
    printf("get %d bit: %d\n", c, getbit(x, c));
  printf("\n");
  printf("x = %d (1111)\n", x = 15);
  printf("update bit %d to 0 (C support): %d\n", 2, x = updatebit_c(x, 2, 0));
  printf("update bit %d to 1 (C support): %d\n", 3, x = updatebit_c(x, 3, 1));
  for (c = 3; c >= 0; --c)
    printf("get %d bit: %d\n", c, getbit(x, c));
  printf("\n");
  printf("toggle bit %d: %d\n", 1, x = togglebit(x, 1));
  printf("toggle bit %d: %d\n", 3, x = togglebit(x, 3));
  for (c = 3; c >= 0; --c)
    printf("get %d bit: %d\n", c, getbit(x, c));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xf,-0xc(%rbp)
lea    0xe53(%rip),%rdi
mov    $0xf,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
xor    $0x0,%esi
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
xor    $0xf,%esi
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
xor    -0xc(%rbp),%esi
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
and    $0x0,%esi
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
and    $0xf,%esi
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
and    -0xc(%rbp),%esi
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdbd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
or     $0x0,%esi
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
or     $0xf,%esi
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
or     -0xc(%rbp),%esi
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
xor    $0xffffffff,%esi
lea    0xe15(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x3,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     12ff <main+0x16f>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
xor    $0xffffffff,%edi
mov    -0x8(%rbp),%esi
call   10b0 <getbit@plt>
mov    -0x10(%rbp),%esi
mov    %eax,%edx
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    12c0 <main+0x130>
lea    0xd45(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xa,-0xc(%rbp)
lea    0xdce(%rip),%rdi
mov    $0xa,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x3,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     136a <main+0x1da>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   10b0 <getbit@plt>
mov    -0x14(%rbp),%esi
mov    %eax,%edx
lea    0xd84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    132e <main+0x19e>
lea    0xcdb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%edi
mov    $0x2,%esi
call   1070 <setbit@plt>
mov    %eax,%edx
mov    %edx,-0xc(%rbp)
lea    0xd67(%rip),%rdi
mov    $0x2,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x3,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     13e0 <main+0x250>
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   10b0 <getbit@plt>
mov    -0x18(%rbp),%esi
mov    %eax,%edx
lea    0xd0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    13a4 <main+0x214>
lea    0xc65(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%edi
mov    $0x3,%esi
call   1040 <clearbit@plt>
mov    %eax,%edx
mov    %edx,-0xc(%rbp)
lea    0xd06(%rip),%rdi
mov    $0x3,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x3,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1456 <main+0x2c6>
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   10b0 <getbit@plt>
mov    -0x1c(%rbp),%esi
mov    %eax,%edx
lea    0xc98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    141a <main+0x28a>
lea    0xbef(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xf,-0xc(%rbp)
lea    0xcb2(%rip),%rdi
mov    $0xf,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%edi
mov    $0x2,%esi
call   1050 <clearbits_msb@plt>
mov    %eax,%edx
mov    %edx,-0xc(%rbp)
lea    0xc9c(%rip),%rdi
mov    $0x2,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x3,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     14e6 <main+0x356>
mov    -0x8(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   10b0 <getbit@plt>
mov    -0x20(%rbp),%esi
mov    %eax,%edx
lea    0xc08(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    14aa <main+0x31a>
lea    0xb5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xf,-0xc(%rbp)
lea    0xc22(%rip),%rdi
mov    $0xf,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%edi
mov    $0x1,%esi
call   1080 <clearbits_lsb@plt>
mov    %eax,%edx
mov    %edx,-0xc(%rbp)
lea    0xc3c(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x3,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1576 <main+0x3e6>
mov    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   10b0 <getbit@plt>
mov    -0x24(%rbp),%esi
mov    %eax,%edx
lea    0xb78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    153a <main+0x3aa>
lea    0xacf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xf,-0xc(%rbp)
lea    0xb92(%rip),%rdi
mov    $0xf,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%edi
mov    $0x2,%esi
xor    %edx,%edx
call   10a0 <updatebit@plt>
mov    %eax,%edx
mov    %edx,-0xc(%rbp)
lea    0xbdb(%rip),%rdi
mov    $0x2,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%edi
mov    $0x3,%esi
mov    $0x1,%edx
call   10a0 <updatebit@plt>
mov    %eax,%edx
mov    %edx,-0xc(%rbp)
lea    0xbc9(%rip),%rdi
mov    $0x3,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x3,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1632 <main+0x4a2>
mov    -0x8(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   10b0 <getbit@plt>
mov    -0x28(%rbp),%esi
mov    %eax,%edx
lea    0xabc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    15f6 <main+0x466>
lea    0xa13(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xf,-0xc(%rbp)
lea    0xad6(%rip),%rdi
mov    $0xf,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%edi
mov    $0x2,%esi
xor    %edx,%edx
call   1090 <updatebit_c@plt>
mov    %eax,%edx
mov    %edx,-0xc(%rbp)
lea    0xb4f(%rip),%rdi
mov    $0x2,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%edi
mov    $0x3,%esi
mov    $0x1,%edx
call   1090 <updatebit_c@plt>
mov    %eax,%edx
mov    %edx,-0xc(%rbp)
lea    0xb49(%rip),%rdi
mov    $0x3,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x3,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     16ee <main+0x55e>
mov    -0x8(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   10b0 <getbit@plt>
mov    -0x2c(%rbp),%esi
mov    %eax,%edx
lea    0xa00(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    16b2 <main+0x522>
lea    0x957(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%edi
mov    $0x1,%esi
call   1060 <togglebit@plt>
mov    %eax,%edx
mov    %edx,-0xc(%rbp)
lea    0xaf7(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%edi
mov    $0x3,%esi
call   1060 <togglebit@plt>
mov    %eax,%edx
mov    %edx,-0xc(%rbp)
lea    0xad2(%rip),%rdi
mov    $0x3,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x3,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1789 <main+0x5f9>
mov    -0x8(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   10b0 <getbit@plt>
mov    -0x30(%rbp),%esi
mov    %eax,%edx
lea    0x965(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    174d <main+0x5bd>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xe42(%rip),%rdi
mov    $0xf,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x103f(%rip),%rdi
call   1040 <puts@plt>
lea    0xe33(%rip),%rdi
mov    $0xf,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe32(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe35(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x1004(%rip),%rdi
call   1040 <puts@plt>
lea    0xe2d(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe30(%rip),%rdi
mov    $0xf,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe2f(%rip),%rdi
mov    $0xf,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xfbf(%rip),%rdi
call   1040 <puts@plt>
lea    0xe23(%rip),%rdi
mov    $0xf,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe22(%rip),%rdi
mov    $0xf,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe21(%rip),%rdi
mov    $0xf,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf81(%rip),%rdi
call   1040 <puts@plt>
lea    0xe15(%rip),%rdi
mov    $0xfffffff0,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xfffffff0,%edi
mov    $0x3,%esi
call   10d0 <getbit@plt>
lea    0xe05(%rip),%r15
mov    %r15,%rdi
mov    $0x3,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xfffffff0,%edi
mov    $0x2,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
mov    $0x2,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xfffffff0,%edi
mov    $0x1,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
mov    $0x1,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xfffffff0,%edi
xor    %esi,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd10(%rip),%rdi
call   1040 <puts@plt>
lea    0xd97(%rip),%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
mov    $0x3,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
mov    $0x3,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
mov    $0x2,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
mov    $0x2,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
mov    $0x1,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
mov    $0x1,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
xor    %esi,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
mov    $0x2,%esi
call   1090 <setbit@plt>
mov    %eax,%ebp
lea    0xcfe(%rip),%rdi
mov    $0x2,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
mov    $0x3,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
mov    $0x3,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
mov    $0x2,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
mov    $0x2,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
mov    $0x1,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
mov    $0x1,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
xor    %esi,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %ebp,%edi
mov    $0x3,%esi
call   1060 <clearbit@plt>
mov    %eax,%ebp
lea    0xc78(%rip),%rdi
mov    $0x3,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
mov    $0x3,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
mov    $0x3,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
mov    $0x2,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
mov    $0x2,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
mov    $0x1,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
mov    $0x1,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
xor    %esi,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xc02(%rip),%r14
mov    %r14,%rdi
mov    $0xf,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xf,%edi
mov    $0x2,%esi
call   1070 <clearbits_msb@plt>
mov    %eax,%ebp
lea    0xbea(%rip),%rdi
mov    $0x2,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
mov    $0x3,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
mov    $0x3,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
mov    $0x2,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
mov    $0x2,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
mov    $0x1,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
mov    $0x1,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
xor    %esi,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
mov    $0xf,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xf,%edi
mov    $0x1,%esi
call   10a0 <clearbits_lsb@plt>
mov    %eax,%ebp
lea    0xb6d(%rip),%rdi
mov    $0x1,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
mov    $0x3,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
mov    $0x3,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
mov    $0x2,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
mov    $0x2,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
mov    $0x1,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
mov    $0x1,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
xor    %esi,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
mov    $0xf,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xf,%edi
mov    $0x2,%esi
xor    %edx,%edx
call   10c0 <updatebit@plt>
mov    %eax,%ebp
lea    0xaef(%rip),%rdi
mov    $0x2,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
mov    $0x3,%esi
mov    $0x1,%edx
call   10c0 <updatebit@plt>
mov    %eax,%ebp
lea    0xadf(%rip),%rdi
mov    $0x3,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
mov    $0x3,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
mov    $0x3,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
mov    $0x2,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
mov    $0x2,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
mov    $0x1,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
mov    $0x1,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
xor    %esi,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
mov    $0xf,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xf,%edi
mov    $0x2,%esi
xor    %edx,%edx
call   10b0 <updatebit_c@plt>
mov    %eax,%ebp
lea    0xa48(%rip),%rdi
mov    $0x2,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
mov    $0x3,%esi
mov    $0x1,%edx
call   10b0 <updatebit_c@plt>
mov    %eax,%ebp
lea    0xa44(%rip),%rdi
mov    $0x3,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
mov    $0x3,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
mov    $0x3,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
mov    $0x2,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
mov    $0x2,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
mov    $0x1,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
mov    $0x1,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
xor    %esi,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %ebp,%edi
mov    $0x1,%esi
call   1080 <togglebit@plt>
mov    %eax,%ebp
lea    0x9cd(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
mov    $0x3,%esi
call   1080 <togglebit@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
mov    $0x3,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
mov    $0x3,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
mov    $0x2,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
mov    $0x2,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
mov    $0x1,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
mov    $0x1,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
xor    %esi,%esi
call   10d0 <getbit@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"x = %d (1111)\0A\0A\00"
@.str.1 = [5 x i8] c"XOR\0A\00"
@.str.2 = [18 x i8] c"x ^ 0 = %d (x)\0A\00"
@.str.3 = [19 x i8] c"x ^ 1 = %d ~(x)\0A\00"
@.str.4 = [20 x i8] c"x ^ x = %d (0)\0A\0A\00"
@.str.5 = [5 x i8] c"AND\0A\00"
@.str.6 = [19 x i8] c"x & 0 = %d (0)\0A\00"
@.str.7 = [18 x i8] c"x & 1 = %d (x)\0A\00"
@.str.8 = [19 x i8] c"x & x = %d (x)\0A\0A\00"
@.str.9 = [4 x i8] c"OR\0A\00"
@.str.10 = [18 x i8] c"x | 0 = %d (x)\0A\00"
@.str.11 = [18 x i8] c"x | 1 = %d (1)\0A\00"
@.str.12 = [19 x i8] c"x | x = %d (x)\0A\0A\00"
@.str.13 = [5 x i8] c"NOT\0A\00"
@.str.14 = [18 x i8] c"~x = %d ~(x)\0A\00"
@.str.15 = [16 x i8] c"get %d bit: %d\0A\00"
@.str.16 = [3 x i8] c"\0A\0A\00"
@.str.17 = [15 x i8] c"x = %d (1010)\0A\00"
@.str.18 = [2 x i8] c"\0A\00"
@.str.19 = [21 x i8] c"set bit %d to 1: %d\0A\00"
@.str.20 = [23 x i8] c"clear bit %d to 0: %d\0A\00"
@.str.21 = [15 x i8] c"x = %d (1111)\0A\00"
@.str.22 = [48 x i8] c"clear most significant bits through bit %d: %d\0A\00"
@.str.23 = [49 x i8] c"clear least significant bits through bit %d: %d\0A\00"
@.str.24 = [24 x i8] c"update bit %d to 0: %d\0A\00"
@.str.25 = [24 x i8] c"update bit %d to 1: %d\0A\00"
@.str.26 = [36 x i8] c"update bit %d to 0 (C support): %d\0A\00"
@.str.27 = [36 x i8] c"update bit %d to 1 (C support): %d\0A\00"
@.str.28 = [19 x i8] c"toggle bit %d: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 15, i32* %3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 15)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%6 = load i32, i32* %3
%7 = xor i32 %6, 0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %3
%10 = xor i32 %9, 15
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %3
%13 = load i32, i32* %3
%14 = xor i32 %12, %13
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%17 = load i32, i32* %3
%18 = and i32 %17, 0
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i32 %18)
%20 = load i32, i32* %3
%21 = and i32 %20, 15
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %3
%24 = load i32, i32* %3
%25 = and i32 %23, %24
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i32 %25)
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%28 = load i32, i32* %3
%29 = or i32 %28, 0
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), i32 %29)
%31 = load i32, i32* %3
%32 = or i32 %31, 15
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.11, i64 0, i64 0), i32 %32)
%34 = load i32, i32* %3
%35 = load i32, i32* %3
%36 = or i32 %34, %35
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.12, i64 0, i64 0), i32 %36)
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0))
%39 = load i32, i32* %3
%40 = xor i32 %39, -1
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.14, i64 0, i64 0), i32 %40)
store i32 3, i32* %2
br label %42
42: ; preds = %52, %0
%43 = load i32, i32* %2
%44 = icmp sge i32 %43, 0
br i1 %44, label %45, label %55
45: ; preds = %42
%46 = load i32, i32* %2
%47 = load i32, i32* %3
%48 = xor i32 %47, -1
%49 = load i32, i32* %2
%50 = call i32 @getbit(i32 %48, i32 %49)
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 %46, i32 %50)
br label %52
52: ; preds = %45
%53 = load i32, i32* %2
%54 = add nsw i32 %53, -1
store i32 %54, i32* %2
br label %42
55: ; preds = %42
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i64 0, i64 0))
store i32 10, i32* %3
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.17, i64 0, i64 0), i32 10)
store i32 3, i32* %2
br label %58
58: ; preds = %67, %55
%59 = load i32, i32* %2
%60 = icmp sge i32 %59, 0
br i1 %60, label %61, label %70
61: ; preds = %58
%62 = load i32, i32* %2
%63 = load i32, i32* %3
%64 = load i32, i32* %2
%65 = call i32 @getbit(i32 %63, i32 %64)
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 %62, i32 %65)
br label %67
67: ; preds = %61
%68 = load i32, i32* %2
%69 = add nsw i32 %68, -1
store i32 %69, i32* %2
br label %58
70: ; preds = %58
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.18, i64 0, i64 0))
%72 = load i32, i32* %3
%73 = call i32 @setbit(i32 %72, i32 2)
store i32 %73, i32* %3
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.19, i64 0, i64 0), i32 2, i32 %73)
store i32 3, i32* %2
br label %75
75: ; preds = %84, %70
%76 = load i32, i32* %2
%77 = icmp sge i32 %76, 0
br i1 %77, label %78, label %87
78: ; preds = %75
%79 = load i32, i32* %2
%80 = load i32, i32* %3
%81 = load i32, i32* %2
%82 = call i32 @getbit(i32 %80, i32 %81)
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 %79, i32 %82)
br label %84
84: ; preds = %78
%85 = load i32, i32* %2
%86 = add nsw i32 %85, -1
store i32 %86, i32* %2
br label %75
87: ; preds = %75
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.18, i64 0, i64 0))
%89 = load i32, i32* %3
%90 = call i32 @clearbit(i32 %89, i32 3)
store i32 %90, i32* %3
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.20, i64 0, i64 0), i32 3, i32 %90)
store i32 3, i32* %2
br label %92
92: ; preds = %101, %87
%93 = load i32, i32* %2
%94 = icmp sge i32 %93, 0
br i1 %94, label %95, label %104
95: ; preds = %92
%96 = load i32, i32* %2
%97 = load i32, i32* %3
%98 = load i32, i32* %2
%99 = call i32 @getbit(i32 %97, i32 %98)
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 %96, i32 %99)
br label %101
101: ; preds = %95
%102 = load i32, i32* %2
%103 = add nsw i32 %102, -1
store i32 %103, i32* %2
br label %92
104: ; preds = %92
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.18, i64 0, i64 0))
store i32 15, i32* %3
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.21, i64 0, i64 0), i32 15)
%107 = load i32, i32* %3
%108 = call i32 @clearbits_msb(i32 %107, i32 2)
store i32 %108, i32* %3
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.22, i64 0, i64 0), i32 2, i32 %108)
store i32 3, i32* %2
br label %110
110: ; preds = %119, %104
%111 = load i32, i32* %2
%112 = icmp sge i32 %111, 0
br i1 %112, label %113, label %122
113: ; preds = %110
%114 = load i32, i32* %2
%115 = load i32, i32* %3
%116 = load i32, i32* %2
%117 = call i32 @getbit(i32 %115, i32 %116)
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 %114, i32 %117)
br label %119
119: ; preds = %113
%120 = load i32, i32* %2
%121 = add nsw i32 %120, -1
store i32 %121, i32* %2
br label %110
122: ; preds = %110
%123 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.18, i64 0, i64 0))
store i32 15, i32* %3
%124 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.21, i64 0, i64 0), i32 15)
%125 = load i32, i32* %3
%126 = call i32 @clearbits_lsb(i32 %125, i32 1)
store i32 %126, i32* %3
%127 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.23, i64 0, i64 0), i32 1, i32 %126)
store i32 3, i32* %2
br label %128
128: ; preds = %137, %122
%129 = load i32, i32* %2
%130 = icmp sge i32 %129, 0
br i1 %130, label %131, label %140
131: ; preds = %128
%132 = load i32, i32* %2
%133 = load i32, i32* %3
%134 = load i32, i32* %2
%135 = call i32 @getbit(i32 %133, i32 %134)
%136 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 %132, i32 %135)
br label %137
137: ; preds = %131
%138 = load i32, i32* %2
%139 = add nsw i32 %138, -1
store i32 %139, i32* %2
br label %128
140: ; preds = %128
%141 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.18, i64 0, i64 0))
store i32 15, i32* %3
%142 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.21, i64 0, i64 0), i32 15)
%143 = load i32, i32* %3
%144 = call i32 @updatebit(i32 %143, i32 2, i32 0)
store i32 %144, i32* %3
%145 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.24, i64 0, i64 0), i32 2, i32 %144)
%146 = load i32, i32* %3
%147 = call i32 @updatebit(i32 %146, i32 3, i32 1)
store i32 %147, i32* %3
%148 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.25, i64 0, i64 0), i32 3, i32 %147)
store i32 3, i32* %2
br label %149
149: ; preds = %158, %140
%150 = load i32, i32* %2
%151 = icmp sge i32 %150, 0
br i1 %151, label %152, label %161
152: ; preds = %149
%153 = load i32, i32* %2
%154 = load i32, i32* %3
%155 = load i32, i32* %2
%156 = call i32 @getbit(i32 %154, i32 %155)
%157 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 %153, i32 %156)
br label %158
158: ; preds = %152
%159 = load i32, i32* %2
%160 = add nsw i32 %159, -1
store i32 %160, i32* %2
br label %149
161: ; preds = %149
%162 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.18, i64 0, i64 0))
store i32 15, i32* %3
%163 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.21, i64 0, i64 0), i32 15)
%164 = load i32, i32* %3
%165 = call i32 @updatebit_c(i32 %164, i32 2, i32 0)
store i32 %165, i32* %3
%166 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.26, i64 0, i64 0), i32 2, i32 %165)
%167 = load i32, i32* %3
%168 = call i32 @updatebit_c(i32 %167, i32 3, i32 1)
store i32 %168, i32* %3
%169 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.27, i64 0, i64 0), i32 3, i32 %168)
store i32 3, i32* %2
br label %170
170: ; preds = %179, %161
%171 = load i32, i32* %2
%172 = icmp sge i32 %171, 0
br i1 %172, label %173, label %182
173: ; preds = %170
%174 = load i32, i32* %2
%175 = load i32, i32* %3
%176 = load i32, i32* %2
%177 = call i32 @getbit(i32 %175, i32 %176)
%178 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 %174, i32 %177)
br label %179
179: ; preds = %173
%180 = load i32, i32* %2
%181 = add nsw i32 %180, -1
store i32 %181, i32* %2
br label %170
182: ; preds = %170
%183 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.18, i64 0, i64 0))
%184 = load i32, i32* %3
%185 = call i32 @togglebit(i32 %184, i32 1)
store i32 %185, i32* %3
%186 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.28, i64 0, i64 0), i32 1, i32 %185)
%187 = load i32, i32* %3
%188 = call i32 @togglebit(i32 %187, i32 3)
store i32 %188, i32* %3
%189 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.28, i64 0, i64 0), i32 3, i32 %188)
store i32 3, i32* %2
br label %190
190: ; preds = %199, %182
%191 = load i32, i32* %2
%192 = icmp sge i32 %191, 0
br i1 %192, label %193, label %202
193: ; preds = %190
%194 = load i32, i32* %2
%195 = load i32, i32* %3
%196 = load i32, i32* %2
%197 = call i32 @getbit(i32 %195, i32 %196)
%198 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 %194, i32 %197)
br label %199
199: ; preds = %193
%200 = load i32, i32* %2
%201 = add nsw i32 %200, -1
store i32 %201, i32* %2
br label %190
202: ; preds = %190
%203 = load i32, i32* %1
ret i32 %203
}

LLVM IR (-O2):
@.str = [16 x i8] c"x = %d (1111)\0A\0A\00"
@.str.2 = [18 x i8] c"x ^ 0 = %d (x)\0A\00"
@.str.3 = [19 x i8] c"x ^ 1 = %d ~(x)\0A\00"
@.str.4 = [20 x i8] c"x ^ x = %d (0)\0A\0A\00"
@.str.6 = [19 x i8] c"x & 0 = %d (0)\0A\00"
@.str.7 = [18 x i8] c"x & 1 = %d (x)\0A\00"
@.str.8 = [19 x i8] c"x & x = %d (x)\0A\0A\00"
@.str.10 = [18 x i8] c"x | 0 = %d (x)\0A\00"
@.str.11 = [18 x i8] c"x | 1 = %d (1)\0A\00"
@.str.12 = [19 x i8] c"x | x = %d (x)\0A\0A\00"
@.str.14 = [18 x i8] c"~x = %d ~(x)\0A\00"
@.str.15 = [16 x i8] c"get %d bit: %d\0A\00"
@.str.17 = [15 x i8] c"x = %d (1010)\0A\00"
@.str.19 = [21 x i8] c"set bit %d to 1: %d\0A\00"
@.str.20 = [23 x i8] c"clear bit %d to 0: %d\0A\00"
@.str.21 = [15 x i8] c"x = %d (1111)\0A\00"
@.str.22 = [48 x i8] c"clear most significant bits through bit %d: %d\0A\00"
@.str.23 = [49 x i8] c"clear least significant bits through bit %d: %d\0A\00"
@.str.24 = [24 x i8] c"update bit %d to 0: %d\0A\00"
@.str.25 = [24 x i8] c"update bit %d to 1: %d\0A\00"
@.str.26 = [36 x i8] c"update bit %d to 0 (C support): %d\0A\00"
@.str.27 = [36 x i8] c"update bit %d to 1 (C support): %d\0A\00"
@.str.28 = [19 x i8] c"toggle bit %d: %d\0A\00"
@str = [4 x i8] c"XOR\00"
@str.29 = [4 x i8] c"AND\00"
@str.30 = [3 x i8] c"OR\00"
@str.31 = [4 x i8] c"NOT\00"
@str.32 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 15)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 15)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 0)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 0)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.29, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i32 0)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i32 15)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i32 15)
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.30, i64 0, i64 0))
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), i32 15)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.11, i64 0, i64 0), i32 15)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.12, i64 0, i64 0), i32 15)
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.31, i64 0, i64 0))
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.14, i64 0, i64 0), i32 -16)
%16 = tail call i32 @getbit(i32 -16, i32 3)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 3, i32 %16)
%18 = tail call i32 @getbit(i32 -16, i32 2)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 2, i32 %18)
%20 = tail call i32 @getbit(i32 -16, i32 1)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 1, i32 %20)
%22 = tail call i32 @getbit(i32 -16, i32 0)
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 0, i32 %22)
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.32, i64 0, i64 0))
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.17, i64 0, i64 0), i32 10)
%26 = tail call i32 @getbit(i32 10, i32 3)
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 3, i32 %26)
%28 = tail call i32 @getbit(i32 10, i32 2)
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 2, i32 %28)
%30 = tail call i32 @getbit(i32 10, i32 1)
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 1, i32 %30)
%32 = tail call i32 @getbit(i32 10, i32 0)
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 0, i32 %32)
%34 = tail call i32 @putchar(i32 10)
%35 = tail call i32 @setbit(i32 10, i32 2)
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.19, i64 0, i64 0), i32 2, i32 %35)
%37 = tail call i32 @getbit(i32 %35, i32 3)
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 3, i32 %37)
%39 = tail call i32 @getbit(i32 %35, i32 2)
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 2, i32 %39)
%41 = tail call i32 @getbit(i32 %35, i32 1)
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 1, i32 %41)
%43 = tail call i32 @getbit(i32 %35, i32 0)
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 0, i32 %43)
%45 = tail call i32 @putchar(i32 10)
%46 = tail call i32 @clearbit(i32 %35, i32 3)
%47 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.20, i64 0, i64 0), i32 3, i32 %46)
%48 = tail call i32 @getbit(i32 %46, i32 3)
%49 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 3, i32 %48)
%50 = tail call i32 @getbit(i32 %46, i32 2)
%51 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 2, i32 %50)
%52 = tail call i32 @getbit(i32 %46, i32 1)
%53 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 1, i32 %52)
%54 = tail call i32 @getbit(i32 %46, i32 0)
%55 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 0, i32 %54)
%56 = tail call i32 @putchar(i32 10)
%57 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.21, i64 0, i64 0), i32 15)
%58 = tail call i32 @clearbits_msb(i32 15, i32 2)
%59 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.22, i64 0, i64 0), i32 2, i32 %58)
%60 = tail call i32 @getbit(i32 %58, i32 3)
%61 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 3, i32 %60)
%62 = tail call i32 @getbit(i32 %58, i32 2)
%63 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 2, i32 %62)
%64 = tail call i32 @getbit(i32 %58, i32 1)
%65 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 1, i32 %64)
%66 = tail call i32 @getbit(i32 %58, i32 0)
%67 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 0, i32 %66)
%68 = tail call i32 @putchar(i32 10)
%69 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.21, i64 0, i64 0), i32 15)
%70 = tail call i32 @clearbits_lsb(i32 15, i32 1)
%71 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.23, i64 0, i64 0), i32 1, i32 %70)
%72 = tail call i32 @getbit(i32 %70, i32 3)
%73 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 3, i32 %72)
%74 = tail call i32 @getbit(i32 %70, i32 2)
%75 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 2, i32 %74)
%76 = tail call i32 @getbit(i32 %70, i32 1)
%77 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 1, i32 %76)
%78 = tail call i32 @getbit(i32 %70, i32 0)
%79 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 0, i32 %78)
%80 = tail call i32 @putchar(i32 10)
%81 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.21, i64 0, i64 0), i32 15)
%82 = tail call i32 @updatebit(i32 15, i32 2, i32 0)
%83 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.24, i64 0, i64 0), i32 2, i32 %82)
%84 = tail call i32 @updatebit(i32 %82, i32 3, i32 1)
%85 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.25, i64 0, i64 0), i32 3, i32 %84)
%86 = tail call i32 @getbit(i32 %84, i32 3)
%87 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 3, i32 %86)
%88 = tail call i32 @getbit(i32 %84, i32 2)
%89 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 2, i32 %88)
%90 = tail call i32 @getbit(i32 %84, i32 1)
%91 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 1, i32 %90)
%92 = tail call i32 @getbit(i32 %84, i32 0)
%93 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 0, i32 %92)
%94 = tail call i32 @putchar(i32 10)
%95 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.21, i64 0, i64 0), i32 15)
%96 = tail call i32 @updatebit_c(i32 15, i32 2, i32 0)
%97 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.26, i64 0, i64 0), i32 2, i32 %96)
%98 = tail call i32 @updatebit_c(i32 %96, i32 3, i32 1)
%99 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.27, i64 0, i64 0), i32 3, i32 %98)
%100 = tail call i32 @getbit(i32 %98, i32 3)
%101 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 3, i32 %100)
%102 = tail call i32 @getbit(i32 %98, i32 2)
%103 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 2, i32 %102)
%104 = tail call i32 @getbit(i32 %98, i32 1)
%105 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 1, i32 %104)
%106 = tail call i32 @getbit(i32 %98, i32 0)
%107 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 0, i32 %106)
%108 = tail call i32 @putchar(i32 10)
%109 = tail call i32 @togglebit(i32 %98, i32 1)
%110 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.28, i64 0, i64 0), i32 1, i32 %109)
%111 = tail call i32 @togglebit(i32 %109, i32 3)
%112 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.28, i64 0, i64 0), i32 3, i32 %111)
%113 = tail call i32 @getbit(i32 %111, i32 3)
%114 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 3, i32 %113)
%115 = tail call i32 @getbit(i32 %111, i32 2)
%116 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 2, i32 %115)
%117 = tail call i32 @getbit(i32 %111, i32 1)
%118 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 1, i32 %117)
%119 = tail call i32 @getbit(i32 %111, i32 0)
%120 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 0, i32 %119)
ret i32 0
}