#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__ next(int *, int);
int /*<<< orphan*/ printv(int *, int);
int main(int argc, char *argv[]) {
  int n = 10;
  int mask[16];
  int i;
  for (i = 0; i < n; ++i)
    mask[i] = 0;
  printv(mask, n);
  while (next(mask, n))
    printv(mask, n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xa,-0x14(%rbp)
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    116a <main+0x4a>
movslq -0x64(%rbp),%rax
movl   $0x0,-0x60(%rbp,%rax,4)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1144 <main+0x24>
lea    -0x60(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <printv@plt>
lea    -0x60(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <next@plt>
cmp    $0x0,%rax
je     119d <main+0x7d>
lea    -0x60(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <printv@plt>
jmp    1176 <main+0x56>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movq   $0x0,0x20(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <printv@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <next@plt>
test   %rax,%rax
je     117f <main+0x5f>
mov    %rsp,%rbx
nop
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <printv@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <next@plt>
test   %rax,%rax
jne    1160 <main+0x40>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [16 x i32]
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 10, i32* %6
store i32 0, i32* %8
br label %9
9: ; preds = %17, %2
%10 = load i32, i32* %8
%11 = load i32, i32* %6
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %20
13: ; preds = %9
%14 = load i32, i32* %8
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [16 x i32], [16 x i32]* %7, i64 0, i64 %15
store i32 0, i32* %16
br label %17
17: ; preds = %13
%18 = load i32, i32* %8
%19 = add nsw i32 %18, 1
store i32 %19, i32* %8
br label %9
20: ; preds = %9
%21 = getelementptr inbounds [16 x i32], [16 x i32]* %7, i64 0, i64 0
%22 = load i32, i32* %6
%23 = call i32 @printv(i32* %21, i32 %22)
br label %24
24: ; preds = %29, %20
%25 = getelementptr inbounds [16 x i32], [16 x i32]* %7, i64 0, i64 0
%26 = load i32, i32* %6
%27 = call i64 @next(i32* %25, i32 %26)
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %33
29: ; preds = %24
%30 = getelementptr inbounds [16 x i32], [16 x i32]* %7, i64 0, i64 0
%31 = load i32, i32* %6
%32 = call i32 @printv(i32* %30, i32 %31)
br label %24
33: ; preds = %24
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [16 x i32]
%4 = bitcast [16 x i32]* %3 to i8*
%5 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 0
%6 = call i32 @printv(i32* %5, i32 10)
%7 = call i64 @next(i32* %5, i32 10)
%8 = icmp eq i64 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %2, %9
%10 = call i32 @printv(i32* %5, i32 10)
%11 = call i64 @next(i32* %5, i32 10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %9
13: ; preds = %9, %2
ret i32 0
}