#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 */
scalar_t__ increment(int *);
int /*<<< orphan*/ print_number(int *, int *);
void print_words(int number[]) {
  int places[7];
  size_t i;
  for (i = 0; i < 7; i++) {
    if (number[i] == 0 || number[i] == 1) {
      places[i] = -1;
    } else {
      places[i] = 1;
    }
  }
  print_number(places, number);
  while (increment(places)) {
    print_number(places, number);
  }
}


x86 assembly (clang, -O0):
<print_words>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x38(%rbp)
cmpq   $0x7,-0x38(%rbp)
jae    1196 <print_words+0x76>
mov    -0x8(%rbp),%rax
mov    -0x38(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     1163 <print_words+0x43>
mov    -0x8(%rbp),%rax
mov    -0x38(%rbp),%rcx
cmpl   $0x1,(%rax,%rcx,4)
jne    1174 <print_words+0x54>
mov    -0x38(%rbp),%rax
movl   $0xffffffff,-0x30(%rbp,%rax,4)
ff
jmp    1180 <print_words+0x60>
mov    -0x38(%rbp),%rax
movl   $0x1,-0x30(%rbp,%rax,4)
jmp    1185 <print_words+0x65>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1134 <print_words+0x14>
lea    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <print_number@plt>
lea    -0x30(%rbp),%rdi
call   1030 <increment@plt>
cmp    $0x0,%rax
je     11c8 <print_words+0xa8>
lea    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <print_number@plt>
jmp    11a3 <print_words+0x83>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_words>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rdi,%r14
movdqu (%rdi),%xmm0
pxor   0xeca(%rip),%xmm0
pcmpgtd 0xed2(%rip),%xmm0
pcmpeqd %xmm1,%xmm1
pxor   %xmm0,%xmm1
por    0xed2(%rip),%xmm1
movdqa %xmm1,(%rsp)
xor    %eax,%eax
cmpl   $0x2,0x10(%rdi)
setae  %al
add    %eax,%eax
add    $0xffffffff,%eax
mov    %eax,0x10(%rsp)
xor    %eax,%eax
cmpl   $0x2,0x14(%rdi)
setae  %al
add    %eax,%eax
add    $0xffffffff,%eax
mov    %eax,0x14(%rsp)
xor    %eax,%eax
cmpl   $0x2,0x18(%rdi)
setae  %al
add    %eax,%eax
add    $0xffffffff,%eax
mov    %eax,0x18(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <print_number@plt>
mov    %rbx,%rdi
call   1030 <increment@plt>
test   %rax,%rax
je     11c8 <print_words+0xa8>
mov    %rsp,%rbx
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <print_number@plt>
mov    %rbx,%rdi
call   1030 <increment@plt>
test   %rax,%rax
jne    11b0 <print_words+0x90>
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @print_words(i32* %0) {
%2 = alloca i32*
%3 = alloca [7 x i32]
%4 = alloca i64
store i32* %0, i32** %2
store i64 0, i64* %4
br label %5
5: ; preds = %27, %1
%6 = load i64, i64* %4
%7 = icmp ult i64 %6, 7
br i1 %7, label %8, label %30
8: ; preds = %5
%9 = load i32*, i32** %2
%10 = load i64, i64* %4
%11 = getelementptr inbounds i32, i32* %9, i64 %10
%12 = load i32, i32* %11
%13 = icmp eq i32 %12, 0
br i1 %13, label %20, label %14
14: ; preds = %8
%15 = load i32*, i32** %2
%16 = load i64, i64* %4
%17 = getelementptr inbounds i32, i32* %15, i64 %16
%18 = load i32, i32* %17
%19 = icmp eq i32 %18, 1
br i1 %19, label %20, label %23
20: ; preds = %14, %8
%21 = load i64, i64* %4
%22 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 %21
store i32 -1, i32* %22
br label %26
23: ; preds = %14
%24 = load i64, i64* %4
%25 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 %24
store i32 1, i32* %25
br label %26
26: ; preds = %23, %20
br label %27
27: ; preds = %26
%28 = load i64, i64* %4
%29 = add i64 %28, 1
store i64 %29, i64* %4
br label %5
30: ; preds = %5
%31 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 0
%32 = load i32*, i32** %2
%33 = call i32 @print_number(i32* %31, i32* %32)
br label %34
34: ; preds = %38, %30
%35 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 0
%36 = call i64 @increment(i32* %35)
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %42
38: ; preds = %34
%39 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 0
%40 = load i32*, i32** %2
%41 = call i32 @print_number(i32* %39, i32* %40)
br label %34
42: ; preds = %34
ret void
}

LLVM IR (-O2):
define void @print_words(i32* %0) {
%2 = alloca [7 x i32]
%3 = bitcast [7 x i32]* %2 to i8*
%4 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 0
%5 = bitcast i32* %0 to <4 x i32>*
%6 = load <4 x i32>, <4 x i32>* %5
%7 = icmp ugt <4 x i32> %6, <i32 1, i32 1, i32 1, i32 1>
%8 = select <4 x i1> %7, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>
%9 = bitcast [7 x i32]* %2 to <4 x i32>*
store <4 x i32> %8, <4 x i32>* %9
%10 = getelementptr inbounds i32, i32* %0, i64 4
%11 = load i32, i32* %10
%12 = icmp ugt i32 %11, 1
%13 = select i1 %12, i32 1, i32 -1
%14 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 4
store i32 %13, i32* %14
%15 = getelementptr inbounds i32, i32* %0, i64 5
%16 = load i32, i32* %15
%17 = icmp ugt i32 %16, 1
%18 = select i1 %17, i32 1, i32 -1
%19 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 5
store i32 %18, i32* %19
%20 = getelementptr inbounds i32, i32* %0, i64 6
%21 = load i32, i32* %20
%22 = icmp ugt i32 %21, 1
%23 = select i1 %22, i32 1, i32 -1
%24 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 6
store i32 %23, i32* %24
%25 = call i32 @print_number(i32* %4, i32* %0)
%26 = call i64 @increment(i32* %4)
%27 = icmp eq i64 %26, 0
br i1 %27, label %32, label %28
28: ; preds = %1, %28
%29 = call i32 @print_number(i32* %4, i32* %0)
%30 = call i64 @increment(i32* %4)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %28
32: ; preds = %28, %1
ret void
}