#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 binary(int *vet, int n, int i) {
  int j;
  if (i >= n) {
    for (j = 0; j < n; j++) {
      printf("%d", vet[j]);
    }
    printf("\n");
    return;
  }
  vet[i] = 0;
  binary(vet, n, i + 1);
  vet[i] = 1;
  binary(vet, n, i + 1);
  return;
}


x86 assembly (clang, -O0):
<binary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     118b <binary+0x6b>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1178 <binary+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    1145 <binary+0x25>
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11cd <binary+0xad>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
add    $0x1,%edx
call   1030 <binary@plt>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
add    $0x1,%edx
call   1030 <binary@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<binary>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %rdi,%r12
cmp    %esi,%edx
jge    117c <binary+0x4c>
mov    %edx,%ebp
movslq %edx,%rbx
movslq %r14d,%r15
add    $0x1,%ebp
movl   $0x0,(%r12,%rbx,4)
lea    0x1(%rbx),%r13
mov    %r12,%rdi
mov    %r14d,%esi
mov    %ebp,%edx
call   1040 <binary@plt>
movl   $0x1,(%r12,%rbx,4)
add    $0x1,%ebp
mov    %r13,%rbx
cmp    %r13,%r15
jne    1150 <binary+0x20>
test   %r14d,%r14d
jle    11a7 <binary+0x77>
mov    %r14d,%ebp
lea    0xe75(%rip),%r14
xor    %ebx,%ebx
nopl   (%rax)
mov    (%r12,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1190 <binary+0x60>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

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