#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(int, int);
int /*<<< orphan*/ printf(char *, ...);
int setbits(int, int, int, int);
main() {
  int x, y, i, j;
  x = 123;
  y = 87;
  for (i = 1; i < 8; i++) {
    for (j = 1; j <= i; j++) {
      printf("x   ");
      printbits(x, 8);
      printf("\n");
      printf("y   ");
      printbits(y, 8);
      printf("\n");
      printf("%d %d ", i, j);
      printbits(setbits(x, i, j, y), 8);
      printf("\n");
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x7b,-0x8(%rbp)
movl   $0x57,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
cmpl   $0x8,-0x10(%rbp)
jge    122c <main+0xfc>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1210 <main+0xe0>
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    $0x8,%esi
call   1040 <printbits@plt>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%edi
mov    $0x8,%esi
call   1040 <printbits@plt>
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0xc(%rbp),%ecx
call   1050 <setbits@plt>
mov    %eax,%edi
mov    $0x8,%esi
call   1040 <printbits@plt>
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1165 <main+0x35>
lea    0xdee(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1154 <main+0x24>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x1,%ebp
mov    $0x2,%eax
lea    0xea4(%rip),%r14
lea    0xea2(%rip),%r15
lea    0xea0(%rip),%r12
xor    %r13d,%r13d
nopl   (%rax)
mov    %eax,0x4(%rsp)
mov    $0x1,%ebx
nopl   0x0(%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7b,%edi
mov    $0x8,%esi
call   1050 <printbits@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x57,%edi
mov    $0x8,%esi
call   1050 <printbits@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r12,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7b,%edi
mov    %ebp,%esi
mov    %ebx,%edx
mov    $0x57,%ecx
call   1060 <setbits@plt>
mov    %eax,%edi
mov    $0x8,%esi
call   1050 <printbits@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    (%rbx,%r13,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x2,%eax
jne    1180 <main+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
mov    0x4(%rsp),%eax
add    $0x1,%eax
add    $0xffffffff,%r13d
cmp    $0x9,%eax
jne    1170 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"x \00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [5 x i8] c"y \00"
@.str.3 = [7 x i8] c"%d %d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 123, i32* %2
store i32 87, i32* %3
store i32 1, i32* %4
br label %6
6: ; preds = %38, %0
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 8
br i1 %8, label %9, label %41
9: ; preds = %6
store i32 1, i32* %5
br label %10
10: ; preds = %33, %9
%11 = load i32, i32* %5
%12 = load i32, i32* %4
%13 = icmp sle i32 %11, %12
br i1 %13, label %14, label %36
14: ; preds = %10
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%16 = load i32, i32* %2
%17 = call i32 @printbits(i32 %16, i32 8)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%20 = load i32, i32* %3
%21 = call i32 @printbits(i32 %20, i32 8)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%23 = load i32, i32* %4
%24 = load i32, i32* %5
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %23, i32 %24)
%26 = load i32, i32* %2
%27 = load i32, i32* %4
%28 = load i32, i32* %5
%29 = load i32, i32* %3
%30 = call i32 @setbits(i32 %26, i32 %27, i32 %28, i32 %29)
%31 = call i32 @printbits(i32 %30, i32 8)
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %33
33: ; preds = %14
%34 = load i32, i32* %5
%35 = add nsw i32 %34, 1
store i32 %35, i32* %5
br label %10
36: ; preds = %10
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %38
38: ; preds = %36
%39 = load i32, i32* %4
%40 = add nsw i32 %39, 1
store i32 %40, i32* %4
br label %6
41: ; preds = %6
%42 = load i32, i32* %1
ret i32 %42
}

LLVM IR (-O2):
@.str = [5 x i8] c"x \00"
@.str.2 = [5 x i8] c"y \00"
@.str.3 = [7 x i8] c"%d %d \00"
define i32 @main() {
br label %1
1: ; preds = %0, %18
%2 = phi i32 [ 2, %0 ], [ %21, %18 ]
%3 = phi i32 [ 1, %0 ], [ %20, %18 ]
br label %4
4: ; preds = %1, %4
%5 = phi i32 [ 1, %1 ], [ %16, %4 ]
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @printbits(i32 123, i32 8)
%8 = tail call i32 @putchar(i32 10)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%10 = tail call i32 @printbits(i32 87, i32 8)
%11 = tail call i32 @putchar(i32 10)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %3, i32 %5)
%13 = tail call i32 @setbits(i32 123, i32 %3, i32 %5, i32 87)
%14 = tail call i32 @printbits(i32 %13, i32 8)
%15 = tail call i32 @putchar(i32 10)
%16 = add nuw nsw i32 %5, 1
%17 = icmp eq i32 %16, %2
br i1 %17, label %18, label %4
18: ; preds = %4
%19 = tail call i32 @putchar(i32 10)
%20 = add nuw nsw i32 %3, 1
%21 = add nuw nsw i32 %2, 1
%22 = icmp eq i32 %21, 9
br i1 %22, label %23, label %1
23: ; preds = %18
ret i32 0
}