#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 *, ...);
void comb_recursive(int nb[], int index) {
  int n = 0;
  if (index == 3) {
    for (int i = 0; i < 3; i++)
      printf("%d", nb[i]);
    if (!(nb[0] == 7 && nb[1] == 8 && nb[2] == 9))
      printf(", ");
    return;
  }
  while (n <= 9) {
    if (index > 0 && nb[index - 1] >= n) {
      n++;
      continue;
    } else {
      nb[index] = n;
      comb_recursive(nb, index + 1);
    }
    n++;
  }
}


x86 assembly (clang, -O0):
<comb_recursive>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x3,-0xc(%rbp)
jne    11b4 <comb_recursive+0x94>
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    1178 <comb_recursive+0x58>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1147 <comb_recursive+0x27>
mov    -0x8(%rbp),%rax
cmpl   $0x7,(%rax)
jne    11a1 <comb_recursive+0x81>
mov    -0x8(%rbp),%rax
cmpl   $0x8,0x4(%rax)
jne    11a1 <comb_recursive+0x81>
mov    -0x8(%rbp),%rax
cmpl   $0x9,0x8(%rax)
je     11af <comb_recursive+0x8f>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    121f <comb_recursive+0xff>
jmp    11b9 <comb_recursive+0x99>
cmpl   $0x9,-0x10(%rbp)
jg     121f <comb_recursive+0xff>
cmpl   $0x0,-0xc(%rbp)
jle    11f4 <comb_recursive+0xd4>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x10(%rbp),%eax
jl     11f4 <comb_recursive+0xd4>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11b9 <comb_recursive+0x99>
mov    -0x10(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
call   1030 <comb_recursive@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11b9 <comb_recursive+0x99>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<comb_recursive>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
cmp    $0x3,%esi
jne    1189 <comb_recursive+0x69>
mov    (%rbx),%esi
lea    0xec8(%rip),%rbp
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rbx),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rbx),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x7,(%rbx)
jne    1171 <comb_recursive+0x51>
cmpl   $0x8,0x4(%rbx)
jne    1171 <comb_recursive+0x51>
cmpl   $0x9,0x8(%rbx)
je     1279 <comb_recursive+0x159>
lea    0xe8b(%rip),%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>
mov    %esi,%ebp
lea    0x1(%rbp),%r14d
movslq %esi,%r15
test   %esi,%esi
jle    1284 <comb_recursive+0x164>
add    $0xffffffff,%ebp
mov    (%rbx,%rbp,4),%eax
test   %eax,%eax
js     134c <comb_recursive+0x22c>
test   %eax,%eax
jle    136a <comb_recursive+0x24a>
mov    (%rbx,%rbp,4),%eax
cmp    $0x1,%eax
jg     11ce <comb_recursive+0xae>
movl   $0x2,(%rbx,%r15,4)
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <comb_recursive@plt>
mov    (%rbx,%rbp,4),%eax
cmp    $0x2,%eax
jg     11e6 <comb_recursive+0xc6>
movl   $0x3,(%rbx,%r15,4)
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <comb_recursive@plt>
mov    (%rbx,%rbp,4),%eax
cmp    $0x3,%eax
jg     1204 <comb_recursive+0xe4>
movl   $0x4,(%rbx,%r15,4)
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <comb_recursive@plt>
mov    (%rbx,%rbp,4),%eax
cmp    $0x4,%eax
jg     121c <comb_recursive+0xfc>
movl   $0x5,(%rbx,%r15,4)
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <comb_recursive@plt>
mov    (%rbx,%rbp,4),%eax
cmp    $0x5,%eax
jg     123a <comb_recursive+0x11a>
movl   $0x6,(%rbx,%r15,4)
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <comb_recursive@plt>
mov    (%rbx,%rbp,4),%eax
cmp    $0x6,%eax
jg     1252 <comb_recursive+0x132>
movl   $0x7,(%rbx,%r15,4)
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <comb_recursive@plt>
mov    (%rbx,%rbp,4),%eax
cmp    $0x7,%eax
jg     1270 <comb_recursive+0x150>
movl   $0x8,(%rbx,%r15,4)
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <comb_recursive@plt>
mov    (%rbx,%rbp,4),%eax
cmp    $0x8,%eax
jle    132f <comb_recursive+0x20f>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
movl   $0x0,(%rbx,%r15,4)
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <comb_recursive@plt>
movl   $0x1,(%rbx,%r15,4)
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <comb_recursive@plt>
movl   $0x2,(%rbx,%r15,4)
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <comb_recursive@plt>
movl   $0x3,(%rbx,%r15,4)
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <comb_recursive@plt>
movl   $0x4,(%rbx,%r15,4)
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <comb_recursive@plt>
movl   $0x5,(%rbx,%r15,4)
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <comb_recursive@plt>
movl   $0x6,(%rbx,%r15,4)
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <comb_recursive@plt>
movl   $0x7,(%rbx,%r15,4)
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <comb_recursive@plt>
movl   $0x8,(%rbx,%r15,4)
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <comb_recursive@plt>
movl   $0x9,(%rbx,%r15,4)
mov    %rbx,%rdi
mov    %r14d,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <comb_recursive@plt>
movl   $0x0,(%rbx,%r15,4)
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <comb_recursive@plt>
mov    (%rbx,%rbp,4),%eax
test   %eax,%eax
jg     11b0 <comb_recursive+0x90>
movl   $0x1,(%rbx,%r15,4)
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <comb_recursive@plt>
jmp    11b0 <comb_recursive+0x90>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c", \00"
define void @comb_recursive(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 3
br i1 %8, label %9, label %41
9: ; preds = %2
store i32 0, i32* %6
br label %10
10: ; preds = %20, %9
%11 = load i32, i32* %6
%12 = icmp slt i32 %11, 3
br i1 %12, label %13, label %23
13: ; preds = %10
%14 = load i32*, i32** %3
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
%18 = load i32, i32* %17
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %18)
br label %20
20: ; preds = %13
%21 = load i32, i32* %6
%22 = add nsw i32 %21, 1
store i32 %22, i32* %6
br label %10
23: ; preds = %10
%24 = load i32*, i32** %3
%25 = getelementptr inbounds i32, i32* %24, i64 0
%26 = load i32, i32* %25
%27 = icmp eq i32 %26, 7
br i1 %27, label %28, label %38
28: ; preds = %23
%29 = load i32*, i32** %3
%30 = getelementptr inbounds i32, i32* %29, i64 1
%31 = load i32, i32* %30
%32 = icmp eq i32 %31, 8
br i1 %32, label %33, label %38
33: ; preds = %28
%34 = load i32*, i32** %3
%35 = getelementptr inbounds i32, i32* %34, i64 2
%36 = load i32, i32* %35
%37 = icmp eq i32 %36, 9
br i1 %37, label %40, label %38
38: ; preds = %33, %28, %23
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %40
40: ; preds = %38, %33
br label %72
41: ; preds = %2
br label %42
42: ; preds = %69, %57, %41
%43 = load i32, i32* %5
%44 = icmp sle i32 %43, 9
br i1 %44, label %45, label %72
45: ; preds = %42
%46 = load i32, i32* %4
%47 = icmp sgt i32 %46, 0
br i1 %47, label %48, label %60
48: ; preds = %45
%49 = load i32*, i32** %3
%50 = load i32, i32* %4
%51 = sub nsw i32 %50, 1
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i32, i32* %49, i64 %52
%54 = load i32, i32* %53
%55 = load i32, i32* %5
%56 = icmp sge i32 %54, %55
br i1 %56, label %57, label %60
57: ; preds = %48
%58 = load i32, i32* %5
%59 = add nsw i32 %58, 1
store i32 %59, i32* %5
br label %42
60: ; preds = %48, %45
%61 = load i32, i32* %5
%62 = load i32*, i32** %3
%63 = load i32, i32* %4
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i32, i32* %62, i64 %64
store i32 %61, i32* %65
%66 = load i32*, i32** %3
%67 = load i32, i32* %4
%68 = add nsw i32 %67, 1
br label %69
69: ; preds = %60
%70 = load i32, i32* %5
%71 = add nsw i32 %70, 1
store i32 %71, i32* %5
br label %42
72: ; preds = %40, %42
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c", \00"
define void @comb_recursive(i32* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 3
br i1 %3, label %4, label %15
4: ; preds = %2
%5 = load i32, i32* %0
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = getelementptr inbounds i32, i32* %0, i64 1
%8 = load i32, i32* %7
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds i32, i32* %0, i64 2
%11 = load i32, i32* %10
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load i32, i32* %0
%14 = icmp eq i32 %13, 7
br i1 %14, label %23, label %29
15: ; preds = %2
%16 = icmp sgt i32 %1, 0
%17 = add nsw i32 %1, -1
%18 = zext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %0, i64 %18
%20 = sext i32 %1 to i64
%21 = getelementptr inbounds i32, i32* %0, i64 %20
%22 = add nsw i32 %1, 1
br i1 %16, label %31, label %72
23: ; preds = %4
%24 = load i32, i32* %7
%25 = icmp eq i32 %24, 8
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = load i32, i32* %10
%28 = icmp eq i32 %27, 9
br i1 %28, label %77, label %29
29: ; preds = %26, %23, %4
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %77
31: ; preds = %15
%32 = load i32, i32* %19
%33 = icmp slt i32 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %31
store i32 0, i32* %21
tail call void @comb_recursive(i32* %0, i32 %22)
%35 = load i32, i32* %19
br label %36
36: ; preds = %31, %34
%37 = phi i32 [ %35, %34 ], [ %32, %31 ]
%38 = icmp slt i32 %37, 1
br i1 %38, label %39, label %40
39: ; preds = %36
store i32 1, i32* %21
tail call void @comb_recursive(i32* %0, i32 %22)
br label %40
40: ; preds = %36, %39
%41 = load i32, i32* %19
%42 = icmp slt i32 %41, 2
br i1 %42, label %43, label %45
43: ; preds = %40
store i32 2, i32* %21
tail call void @comb_recursive(i32* %0, i32 %22)
%44 = load i32, i32* %19
br label %45
45: ; preds = %40, %43
%46 = phi i32 [ %44, %43 ], [ %41, %40 ]
%47 = icmp slt i32 %46, 3
br i1 %47, label %48, label %49
48: ; preds = %45
store i32 3, i32* %21
tail call void @comb_recursive(i32* %0, i32 %22)
br label %49
49: ; preds = %45, %48
%50 = load i32, i32* %19
%51 = icmp slt i32 %50, 4
br i1 %51, label %52, label %54
52: ; preds = %49
store i32 4, i32* %21
tail call void @comb_recursive(i32* %0, i32 %22)
%53 = load i32, i32* %19
br label %54
54: ; preds = %49, %52
%55 = phi i32 [ %53, %52 ], [ %50, %49 ]
%56 = icmp slt i32 %55, 5
br i1 %56, label %57, label %58
57: ; preds = %54
store i32 5, i32* %21
tail call void @comb_recursive(i32* %0, i32 %22)
br label %58
58: ; preds = %54, %57
%59 = load i32, i32* %19
%60 = icmp slt i32 %59, 6
br i1 %60, label %61, label %63
61: ; preds = %58
store i32 6, i32* %21
tail call void @comb_recursive(i32* %0, i32 %22)
%62 = load i32, i32* %19
br label %63
63: ; preds = %58, %61
%64 = phi i32 [ %62, %61 ], [ %59, %58 ]
%65 = icmp slt i32 %64, 7
br i1 %65, label %66, label %67
66: ; preds = %63
store i32 7, i32* %21
tail call void @comb_recursive(i32* %0, i32 %22)
br label %67
67: ; preds = %63, %66
%68 = load i32, i32* %19
%69 = icmp slt i32 %68, 8
br i1 %69, label %70, label %73
70: ; preds = %67
store i32 8, i32* %21
tail call void @comb_recursive(i32* %0, i32 %22)
%71 = load i32, i32* %19
br label %73
72: ; preds = %15
store i32 0, i32* %21
tail call void @comb_recursive(i32* %0, i32 %22)
store i32 1, i32* %21
tail call void @comb_recursive(i32* %0, i32 %22)
store i32 2, i32* %21
tail call void @comb_recursive(i32* %0, i32 %22)
store i32 3, i32* %21
tail call void @comb_recursive(i32* %0, i32 %22)
store i32 4, i32* %21
tail call void @comb_recursive(i32* %0, i32 %22)
store i32 5, i32* %21
tail call void @comb_recursive(i32* %0, i32 %22)
store i32 6, i32* %21
tail call void @comb_recursive(i32* %0, i32 %22)
store i32 7, i32* %21
tail call void @comb_recursive(i32* %0, i32 %22)
store i32 8, i32* %21
tail call void @comb_recursive(i32* %0, i32 %22)
br label %76
73: ; preds = %67, %70
%74 = phi i32 [ %71, %70 ], [ %68, %67 ]
%75 = icmp slt i32 %74, 9
br i1 %75, label %76, label %77
76: ; preds = %72, %73
store i32 9, i32* %21
tail call void @comb_recursive(i32* %0, i32 %22)
br label %77
77: ; preds = %76, %73, %26, %29
ret void
}