#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 */
typedef int /*<<< orphan*/ buff;

/* Variables and functions */
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int target_n_aux(size_t, int *, int /*<<< orphan*/, int, int, char *,
                 int /*<<< orphan*/);
unsigned target_n(size_t n, int numbers[n], int target) {
  if (n == 0) {
    return 0;
  }
  char buff[n * 32];
  memset(buff, 0, sizeof(buff));
  return target_n_aux(n, numbers, 0, numbers[0], target, buff, 0);
}


x86 assembly (clang, -O0):
<target_n>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114a <target_n+0x2a>
movl   $0x0,-0x4(%rbp)
jmp    11a9 <target_n+0x89>
mov    -0x10(%rbp),%rax
shl    $0x5,%rax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rsp,%rdi
sub    %rax,%rdi
mov    %rdi,-0x38(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x30(%rbp)
mov    %eax,%edx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x38(%rbp),%r9
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x1c(%rbp),%r8d
xor    %edx,%edx
sub    $0x10,%rsp
movl   $0x0,(%rsp)
call   1040 <target_n_aux@plt>
add    $0x10,%rsp
mov    %eax,-0x4(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<target_n>:
test   %rdi,%rdi
je     118b <target_n+0x6b>
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %rsi,%r15
mov    %rdi,%r12
mov    %rsp,%r13
mov    %rdi,%rdx
shl    $0x5,%rdx
mov    %rsp,%rbx
sub    %rdx,%rbx
mov    %rbx,%rsp
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
mov    (%r15),%ecx
sub    $0x8,%rsp
mov    %r12,%rdi
mov    %r15,%rsi
xor    %edx,%edx
mov    %r14d,%r8d
mov    %rbx,%r9
push   $0x0
call   1040 <target_n_aux@plt>
add    $0x10,%rsp
mov    %r13,%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @target_n(i64 %0, i32* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i64
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
store i64 %0, i64* %5
store i32* %1, i32** %6
store i32 %2, i32* %7
%10 = load i64, i64* %5
%11 = load i64, i64* %5
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %3
store i32 0, i32* %4
br label %29
14: ; preds = %3
%15 = load i64, i64* %5
%16 = mul i64 %15, 32
%17 = call i8* @llvm.stacksave()
store i8* %17, i8** %8
%18 = alloca i8, i64 %16
store i64 %16, i64* %9
%19 = trunc i64 %16 to i32
%20 = call i32 @memset(i8* %18, i32 0, i32 %19)
%21 = load i64, i64* %5
%22 = load i32*, i32** %6
%23 = load i32*, i32** %6
%24 = getelementptr inbounds i32, i32* %23, i64 0
%25 = load i32, i32* %24
%26 = load i32, i32* %7
%27 = call i32 @target_n_aux(i64 %21, i32* %22, i32 0, i32 %25, i32 %26, i8* %18, i32 0)
store i32 %27, i32* %4
%28 = load i8*, i8** %8
br label %29
29: ; preds = %14, %13
%30 = load i32, i32* %4
ret i32 %30
}

LLVM IR (-O2):
define i32 @target_n(i64 %0, i32* %1, i32 %2) {
%4 = icmp eq i64 %0, 0
br i1 %4, label %13, label %5
5: ; preds = %3
%6 = shl i64 %0, 5
%7 = tail call i8* @llvm.stacksave()
%8 = alloca i8, i64 %6
%9 = trunc i64 %6 to i32
%10 = call i32 @memset(i8* %8, i32 0, i32 %9)
%11 = load i32, i32* %1
%12 = call i32 @target_n_aux(i64 %0, i32* %1, i32 0, i32 %11, i32 %2, i8* %8, i32 0)
br label %13
13: ; preds = %3, %5
%14 = phi i32 [ %12, %5 ], [ 0, %3 ]
ret i32 %14
}