#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 invert(unsigned int, int, int);
int /*<<< orphan*/ printf(char *, unsigned int, int, int, unsigned int);
int main() {
  unsigned x, k;
  int p, n;
  for (x = 0; x < 700; x += 49) {
    for (p = 1; p < 8; p++) {
      for (n = 1; n < 8; n++) {
        k = invert(x, p, n);
        printf("invert(%u,%d,%d)=%u\n", x, p, n, k);
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x2bc,-0x8(%rbp)
jae    11c3 <main+0xa3>
movl   $0x1,-0x10(%rbp)
cmpl   $0x8,-0x10(%rbp)
jge    11b0 <main+0x90>
movl   $0x1,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    119d <main+0x7d>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1030 <invert@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0xc(%rbp),%r8d
lea    0xe76(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115b <main+0x3b>
jmp    11a2 <main+0x82>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    114a <main+0x2a>
jmp    11b5 <main+0x95>
mov    -0x8(%rbp),%eax
add    $0x31,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %ebx,%ebx
lea    0xed3(%rip),%r14
nopl   (%rax)
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,%edi
mov    %ebp,%esi
mov    $0x1,%edx
call   1030 <invert@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    $0x1,%ecx
mov    %eax,%r8d
call   1040 <printf@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    $0x2,%edx
call   1030 <invert@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    $0x2,%ecx
mov    %eax,%r8d
call   1040 <printf@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    $0x3,%edx
call   1030 <invert@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    $0x3,%ecx
mov    %eax,%r8d
call   1040 <printf@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    $0x4,%edx
call   1030 <invert@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    $0x4,%ecx
mov    %eax,%r8d
call   1040 <printf@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    $0x5,%edx
call   1030 <invert@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    $0x5,%ecx
mov    %eax,%r8d
call   1040 <printf@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    $0x6,%edx
call   1030 <invert@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    $0x6,%ecx
mov    %eax,%r8d
call   1040 <printf@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    $0x7,%edx
call   1030 <invert@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    $0x7,%ecx
mov    %eax,%r8d
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    $0x8,%ebp
jne    1140 <main+0x20>
lea    0x31(%rbx),%eax
cmp    $0x28b,%ebx
mov    %eax,%ebx
jb     1130 <main+0x10>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"invert(%u,%d,%d)=%u\0A\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 0, i32* %2
br label %6
6: ; preds = %35, %0
%7 = load i32, i32* %2
%8 = icmp ult i32 %7, 700
br i1 %8, label %9, label %38
9: ; preds = %6
store i32 1, i32* %4
br label %10
10: ; preds = %31, %9
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 8
br i1 %12, label %13, label %34
13: ; preds = %10
store i32 1, i32* %5
br label %14
14: ; preds = %27, %13
%15 = load i32, i32* %5
%16 = icmp slt i32 %15, 8
br i1 %16, label %17, label %30
17: ; preds = %14
%18 = load i32, i32* %2
%19 = load i32, i32* %4
%20 = load i32, i32* %5
%21 = call i32 @invert(i32 %18, i32 %19, i32 %20)
store i32 %21, i32* %3
%22 = load i32, i32* %2
%23 = load i32, i32* %4
%24 = load i32, i32* %5
%25 = load i32, i32* %3
%26 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %22, i32 %23, i32 %24, i32 %25)
br label %27
27: ; preds = %17
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
br label %14
30: ; preds = %14
br label %31
31: ; preds = %30
%32 = load i32, i32* %4
%33 = add nsw i32 %32, 1
store i32 %33, i32* %4
br label %10
34: ; preds = %10
br label %35
35: ; preds = %34
%36 = load i32, i32* %2
%37 = add i32 %36, 49
store i32 %37, i32* %2
br label %6
38: ; preds = %6
ret i32 0
}

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