#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*/ ft_putint(int *, int);
int /*<<< orphan*/ ft_putnbr(int);
int ft_verif(int *, int);
void ft_find_queens(int *table, int queen) {
  static int possibility = 0;
  table[queen]++;
  if (table[queen] > 8) {
    table[queen] = 0;
    ft_find_queens(table, queen - 1);
  } else {
    while (ft_verif(table, queen) == 1 && table[queen] < 8)
      table[queen]++;
    if (ft_verif(table, queen) == 0 && queen != 7)
      ft_find_queens(table, queen + 1);
    else {
      if (queen == 1 && table[0] == 8)
        ft_putnbr(possibility);
      else {
        if (queen == 7 && ft_verif(table, queen) == 0 && possibility++)
          ft_putint(table, 8);
        table[queen] = 0;
        ft_find_queens(table, queen - 1);
      }
    }
  }
}


x86 assembly (clang, -O0):
<ft_find_queens>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpl   $0x8,(%rax,%rcx,4)
jle    1195 <ft_find_queens+0x55>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
call   1060 <ft_find_queens@plt>
jmp    12b7 <ft_find_queens+0x177>
jmp    119a <ft_find_queens+0x5a>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <ft_verif@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
mov    %al,-0xd(%rbp)
jne    11c8 <ft_find_queens+0x88>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpl   $0x8,(%rax,%rcx,4)
setl   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    11d8 <ft_find_queens+0x98>
jmp    11ee <ft_find_queens+0xae>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
jmp    119a <ft_find_queens+0x5a>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <ft_verif@plt>
cmp    $0x0,%eax
jne    1221 <ft_find_queens+0xe1>
cmpl   $0x7,-0xc(%rbp)
je     1221 <ft_find_queens+0xe1>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
call   1060 <ft_find_queens@plt>
jmp    12b2 <ft_find_queens+0x172>
cmpl   $0x1,-0xc(%rbp)
jne    1248 <ft_find_queens+0x108>
mov    -0x8(%rbp),%rax
cmpl   $0x8,(%rax)
jne    1248 <ft_find_queens+0x108>
mov    0x2e06(%rip),%edi
call   1050 <ft_putnbr@plt>
jmp    12ad <ft_find_queens+0x16d>
cmpl   $0x7,-0xc(%rbp)
jne    128f <ft_find_queens+0x14f>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <ft_verif@plt>
cmp    $0x0,%eax
jne    128f <ft_find_queens+0x14f>
mov    0x2dd7(%rip),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0x2dcc(%rip)
cmp    $0x0,%eax
je     128f <ft_find_queens+0x14f>
mov    -0x8(%rbp),%rdi
mov    $0x8,%esi
call   1040 <ft_putint@plt>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
call   1060 <ft_find_queens@plt>
jmp    12b2 <ft_find_queens+0x172>
jmp    12b7 <ft_find_queens+0x177>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_find_queens>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
jmp    114f <ft_find_queens+0x1f>
nopl   0x0(%rax)
movl   $0x0,(%rbx,%rbp,4)
mov    $0xffffffff,%ecx
add    %ecx,%r14d
movslq %r14d,%rbp
mov    (%rbx,%rbp,4),%eax
lea    0x1(%rax),%ecx
mov    %ecx,(%rbx,%rbp,4)
cmp    $0x7,%eax
jg     1140 <ft_find_queens+0x10>
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <ft_verif@plt>
cmp    $0x1,%eax
jne    1180 <ft_find_queens+0x50>
mov    (%rbx,%rbp,4),%eax
cmp    $0x7,%eax
jg     1180 <ft_find_queens+0x50>
add    $0x1,%eax
mov    %eax,(%rbx,%rbp,4)
jmp    1160 <ft_find_queens+0x30>
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <ft_verif@plt>
cmp    $0x7,%r14d
je     119a <ft_find_queens+0x6a>
mov    $0x1,%ecx
test   %eax,%eax
je     114c <ft_find_queens+0x1c>
cmp    $0x7,%r14d
je     11ad <ft_find_queens+0x7d>
cmp    $0x1,%r14d
jne    1140 <ft_find_queens+0x10>
cmpl   $0x8,(%rbx)
jne    1140 <ft_find_queens+0x10>
jmp    11e7 <ft_find_queens+0xb7>
mov    %rbx,%rdi
mov    $0x7,%esi
call   1030 <ft_verif@plt>
test   %eax,%eax
jne    1140 <ft_find_queens+0x10>
mov    0x2e78(%rip),%eax
lea    0x1(%rax),%ecx
mov    %ecx,0x2e6f(%rip)
test   %eax,%eax
je     1140 <ft_find_queens+0x10>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1040 <ft_putint@plt>
jmp    1140 <ft_find_queens+0x10>
mov    0x2e4f(%rip),%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <ft_putnbr@plt>

LLVM IR (-O0):
@ft_find_queens.possibility = internal global i32 0
define void @ft_find_queens(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %5, i64 %7
%9 = load i32, i32* %8
%10 = add nsw i32 %9, 1
store i32 %10, i32* %8
%11 = load i32*, i32** %3
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = icmp sgt i32 %15, 8
br i1 %16, label %17, label %25
17: ; preds = %2
%18 = load i32*, i32** %3
%19 = load i32, i32* %4
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
store i32 0, i32* %21
%22 = load i32*, i32** %3
%23 = load i32, i32* %4
%24 = sub nsw i32 %23, 1
br label %95
25: ; preds = %2
br label %26
26: ; preds = %40, %25
%27 = load i32*, i32** %3
%28 = load i32, i32* %4
%29 = call i32 @ft_verif(i32* %27, i32 %28)
%30 = icmp eq i32 %29, 1
br i1 %30, label %31, label %38
31: ; preds = %26
%32 = load i32*, i32** %3
%33 = load i32, i32* %4
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i32, i32* %32, i64 %34
%36 = load i32, i32* %35
%37 = icmp slt i32 %36, 8
br label %38
38: ; preds = %31, %26
%39 = phi i1 [ false, %26 ], [ %37, %31 ]
br i1 %39, label %40, label %47
40: ; preds = %38
%41 = load i32*, i32** %3
%42 = load i32, i32* %4
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i32, i32* %41, i64 %43
%45 = load i32, i32* %44
%46 = add nsw i32 %45, 1
store i32 %46, i32* %44
br label %26
47: ; preds = %38
%48 = load i32*, i32** %3
%49 = load i32, i32* %4
%50 = call i32 @ft_verif(i32* %48, i32 %49)
%51 = icmp eq i32 %50, 0
br i1 %51, label %52, label %59
52: ; preds = %47
%53 = load i32, i32* %4
%54 = icmp ne i32 %53, 7
br i1 %54, label %55, label %59
55: ; preds = %52
%56 = load i32*, i32** %3
%57 = load i32, i32* %4
%58 = add nsw i32 %57, 1
br label %94
59: ; preds = %52, %47
%60 = load i32, i32* %4
%61 = icmp eq i32 %60, 1
br i1 %61, label %62, label %70
62: ; preds = %59
%63 = load i32*, i32** %3
%64 = getelementptr inbounds i32, i32* %63, i64 0
%65 = load i32, i32* %64
%66 = icmp eq i32 %65, 8
br i1 %66, label %67, label %70
67: ; preds = %62
%68 = load i32, i32* @ft_find_queens.possibility
%69 = call i32 @ft_putnbr(i32 %68)
br label %93
70: ; preds = %62, %59
%71 = load i32, i32* %4
%72 = icmp eq i32 %71, 7
br i1 %72, label %73, label %85
73: ; preds = %70
%74 = load i32*, i32** %3
%75 = load i32, i32* %4
%76 = call i32 @ft_verif(i32* %74, i32 %75)
%77 = icmp eq i32 %76, 0
br i1 %77, label %78, label %85
78: ; preds = %73
%79 = load i32, i32* @ft_find_queens.possibility
%80 = add nsw i32 %79, 1
store i32 %80, i32* @ft_find_queens.possibility
%81 = icmp ne i32 %79, 0
br i1 %81, label %82, label %85
82: ; preds = %78
%83 = load i32*, i32** %3
%84 = call i32 @ft_putint(i32* %83, i32 8)
br label %85
85: ; preds = %82, %78, %73, %70
%86 = load i32*, i32** %3
%87 = load i32, i32* %4
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds i32, i32* %86, i64 %88
store i32 0, i32* %89
%90 = load i32*, i32** %3
%91 = load i32, i32* %4
%92 = sub nsw i32 %91, 1
br label %93
93: ; preds = %85, %67
br label %94
94: ; preds = %93, %55
br label %95
95: ; preds = %94, %17
ret void
}

LLVM IR (-O2):
@ft_find_queens.possibility = internal unnamed_addr global i32 0
define void @ft_find_queens(i32* %0, i32 %1) {
br label %3
3: ; preds = %14, %2
%4 = phi i32 [ %1, %2 ], [ %16, %14 ]
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i32, i32* %0, i64 %5
%7 = load i32, i32* %6
%8 = add nsw i32 %7, 1
store i32 %8, i32* %6
%9 = icmp sgt i32 %7, 7
br i1 %9, label %13, label %10
10: ; preds = %3
%11 = tail call i32 @ft_verif(i32* %0, i32 %4)
%12 = icmp eq i32 %11, 1
br i1 %12, label %17, label %24
13: ; preds = %3, %36, %39, %43, %29, %30
store i32 0, i32* %6
br label %14
14: ; preds = %13, %24
%15 = phi i32 [ 1, %24 ], [ -1, %13 ]
%16 = add nsw i32 %4, %15
br label %3
17: ; preds = %10, %20
%18 = load i32, i32* %6
%19 = icmp slt i32 %18, 8
br i1 %19, label %20, label %24
20: ; preds = %17
%21 = add nsw i32 %18, 1
store i32 %21, i32* %6
%22 = tail call i32 @ft_verif(i32* %0, i32 %4)
%23 = icmp eq i32 %22, 1
br i1 %23, label %17, label %24
24: ; preds = %17, %20, %10
%25 = tail call i32 @ft_verif(i32* %0, i32 %4)
%26 = icmp eq i32 %25, 0
%27 = icmp ne i32 %4, 7
%28 = and i1 %27, %26
br i1 %28, label %14, label %29
29: ; preds = %24
switch i32 %4, label %13 [
i32 1, label %30
i32 7, label %36
]
30: ; preds = %29
%31 = load i32, i32* %0
%32 = icmp eq i32 %31, 8
br i1 %32, label %33, label %13
33: ; preds = %30
%34 = load i32, i32* @ft_find_queens.possibility
%35 = tail call i32 @ft_putnbr(i32 %34)
ret void
36: ; preds = %29
%37 = tail call i32 @ft_verif(i32* %0, i32 7)
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %13
39: ; preds = %36
%40 = load i32, i32* @ft_find_queens.possibility
%41 = add nsw i32 %40, 1
store i32 %41, i32* @ft_find_queens.possibility
%42 = icmp eq i32 %40, 0
br i1 %42, label %13, label %43
43: ; preds = %39
%44 = tail call i32 @ft_putint(i32* %0, i32 8)
br label %13
}