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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jae    11ce <main+0xae>
movl   $0x0,-0x10(%rbp)
cmpl   $0x8,-0x10(%rbp)
jge    11bb <main+0x9b>
movl   $0x0,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jge    11a8 <main+0x88>
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <invert@plt>
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    %eax,%r8d
lea    0xe6b(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1158 <main+0x38>
jmp    11ad <main+0x8d>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1147 <main+0x27>
jmp    11c0 <main+0xa0>
mov    -0x8(%rbp),%eax
add    $0x1,%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)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebx,%edi
xor    %esi,%esi
mov    %ebp,%edx
call   1030 <invert@plt>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %edx,%edx
mov    %ebp,%ecx
mov    %eax,%r8d
call   1040 <printf@plt>
mov    %ebx,%edi
mov    $0x1,%esi
mov    %ebp,%edx
call   1030 <invert@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%edx
mov    %ebp,%ecx
mov    %eax,%r8d
call   1040 <printf@plt>
mov    %ebx,%edi
mov    $0x2,%esi
mov    %ebp,%edx
call   1030 <invert@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x2,%edx
mov    %ebp,%ecx
mov    %eax,%r8d
call   1040 <printf@plt>
mov    %ebx,%edi
mov    $0x3,%esi
mov    %ebp,%edx
call   1030 <invert@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x3,%edx
mov    %ebp,%ecx
mov    %eax,%r8d
call   1040 <printf@plt>
mov    %ebx,%edi
mov    $0x4,%esi
mov    %ebp,%edx
call   1030 <invert@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x4,%edx
mov    %ebp,%ecx
mov    %eax,%r8d
call   1040 <printf@plt>
mov    %ebx,%edi
mov    $0x5,%esi
mov    %ebp,%edx
call   1030 <invert@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x5,%edx
mov    %ebp,%ecx
mov    %eax,%r8d
call   1040 <printf@plt>
mov    %ebx,%edi
mov    $0x6,%esi
mov    %ebp,%edx
call   1030 <invert@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x6,%edx
mov    %ebp,%ecx
mov    %eax,%r8d
call   1040 <printf@plt>
mov    %ebx,%edi
mov    $0x7,%esi
mov    %ebp,%edx
call   1030 <invert@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x7,%edx
mov    %ebp,%ecx
mov    %eax,%r8d
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    $0x8,%ebp
jne    1140 <main+0x20>
add    $0x1,%ebx
cmp    $0x64,%ebx
jne    1130 <main+0x10>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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