#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*/ printf(char *, unsigned int, int, int, unsigned int,
                          unsigned int);
unsigned int setbits(unsigned int, int, int, unsigned int);
int main(void) {
  unsigned i;
  unsigned j;
  unsigned k;
  int p;
  int n;
  for (i = 121; i < 1800; i += 511) {
    for (j = 0; j < 75; j += 37) {
      for (p = 0; p < 2; p++) {
        for (n = 1; n <= p + 1; n++) {
          k = setbits(i, p, n, j);
          printf("setbits(%u, %d, %d, %u) = %u\n", i, p, n, j, k);
        }
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x79,-0x8(%rbp)
cmpl   $0x708,-0x8(%rbp)
jae    11f7 <main+0xd7>
movl   $0x0,-0xc(%rbp)
cmpl   $0x4b,-0xc(%rbp)
jae    11e2 <main+0xc2>
movl   $0x0,-0x14(%rbp)
cmpl   $0x2,-0x14(%rbp)
jge    11cf <main+0xaf>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jg     11bc <main+0x9c>
mov    -0x8(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0xc(%rbp),%ecx
call   1040 <setbits@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0xc(%rbp),%r8d
mov    -0x10(%rbp),%r9d
lea    0xe57(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    116c <main+0x4c>
jmp    11c1 <main+0xa1>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115b <main+0x3b>
jmp    11d4 <main+0xb4>
mov    -0xc(%rbp),%eax
add    $0x25,%eax
mov    %eax,-0xc(%rbp)
jmp    114a <main+0x2a>
jmp    11e7 <main+0xc7>
mov    -0x8(%rbp),%eax
add    $0x1ff,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0xfffffe7a,%ebx
lea    0xed0(%rip),%r14
add    $0x1ff,%ebx
mov    %ebx,%edi
xor    %esi,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1040 <setbits@plt>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %edx,%edx
mov    $0x1,%ecx
xor    %r8d,%r8d
mov    %eax,%r9d
call   1030 <printf@plt>
mov    %ebx,%edi
mov    $0x1,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1040 <setbits@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
xor    %r8d,%r8d
mov    %eax,%r9d
call   1030 <printf@plt>
mov    %ebx,%edi
mov    $0x1,%esi
mov    $0x2,%edx
xor    %ecx,%ecx
call   1040 <setbits@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%edx
mov    $0x2,%ecx
xor    %r8d,%r8d
mov    %eax,%r9d
call   1030 <printf@plt>
mov    %ebx,%edi
xor    %esi,%esi
mov    $0x1,%edx
mov    $0x25,%ecx
call   1040 <setbits@plt>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %edx,%edx
mov    $0x1,%ecx
mov    $0x25,%r8d
mov    %eax,%r9d
call   1030 <printf@plt>
mov    %ebx,%edi
mov    $0x1,%esi
mov    $0x1,%edx
mov    $0x25,%ecx
call   1040 <setbits@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
mov    $0x25,%r8d
mov    %eax,%r9d
call   1030 <printf@plt>
mov    %ebx,%edi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x25,%ecx
call   1040 <setbits@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%edx
mov    $0x2,%ecx
mov    $0x25,%r8d
mov    %eax,%r9d
call   1030 <printf@plt>
mov    %ebx,%edi
xor    %esi,%esi
mov    $0x1,%edx
mov    $0x4a,%ecx
call   1040 <setbits@plt>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %edx,%edx
mov    $0x1,%ecx
mov    $0x4a,%r8d
mov    %eax,%r9d
call   1030 <printf@plt>
mov    %ebx,%edi
mov    $0x1,%esi
mov    $0x1,%edx
mov    $0x4a,%ecx
call   1040 <setbits@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
mov    $0x4a,%r8d
mov    %eax,%r9d
call   1030 <printf@plt>
mov    %ebx,%edi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x4a,%ecx
call   1040 <setbits@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%edx
mov    $0x2,%ecx
mov    $0x4a,%r8d
mov    %eax,%r9d
call   1030 <printf@plt>
cmp    $0x509,%ebx
jb     1130 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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