#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 *);
int scanf(char *, ...);
scalar_t__ target_n(size_t, int *, int);
int main(void) {
  printf("Enter the array size, followed by the array elements, followed by "
         "the target value.\n");
  printf("> ");
  size_t arr_sz;
  while (scanf("%zu", &arr_sz) == 1) {
    int numbers[arr_sz];
    size_t i;
    for (i = 0; i < arr_sz; i++) {
      scanf("%d", &numbers[i]);
    }
    int target;
    scanf("%d", &target);
    if (target_n(arr_sz, numbers, target) == 0) {
      printf("Impossible.\n");
    }
    printf("> ");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
lea    0xf03(%rip),%rdi
call   1030 <printf@plt>
lea    0xefa(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    122e <main+0xfe>
mov    -0x10(%rbp),%rax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    11de <main+0xae>
mov    -0x38(%rbp),%rsi
mov    -0x28(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    11a2 <main+0x72>
lea    0xe77(%rip),%rdi
lea    -0x2c(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x38(%rbp),%rsi
mov    -0x10(%rbp),%rdi
mov    -0x2c(%rbp),%edx
call   1050 <target_n@plt>
cmp    $0x0,%rax
jne    1216 <main+0xe6>
lea    0xe4e(%rip),%rdi
call   1030 <printf@plt>
lea    0xe38(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
jmp    1157 <main+0x27>
xor    %eax,%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xeb2(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9c(%rip),%rdi
call   1040 <printf@plt>
lea    0xe93(%rip),%rdi
lea    -0x30(%rbp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    1232 <main+0xf2>
lea    0xe7c(%rip),%rbx
jmp    11b6 <main+0x76>
nopl   (%rax)
lea    0xe69(%rip),%rdi
call   1040 <printf@plt>
mov    %r13,%rsp
lea    0xe5d(%rip),%rdi
lea    -0x30(%rbp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    1232 <main+0xf2>
mov    %rsp,%r13
mov    -0x30(%rbp),%rax
mov    %rsp,%r12
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
cmpq   $0x0,-0x30(%rbp)
je     11fb <main+0xbb>
mov    %r12,%r14
xor    %r15d,%r15d
nop
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
add    $0x1,%r15
add    $0x4,%r14
cmp    -0x30(%rbp),%r15
jb     11e0 <main+0xa0>
mov    %rbx,%rdi
lea    -0x34(%rbp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%edx
mov    %r12,%rsi
call   1060 <target_n@plt>
test   %rax,%rax
jne    1190 <main+0x50>
lea    0xe36(%rip),%rdi
call   1030 <puts@plt>
jmp    1190 <main+0x50>
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [85 x i8] c"Enter the array size, followed by the array elements, followed by the target value.\0A\00"
@.str.1 = [3 x i8] c"> \00"
@.str.2 = [4 x i8] c"%zu\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [13 x i8] c"Impossible.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @printf(i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %9
9: ; preds = %35, %0
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64* %2)
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %38
12: ; preds = %9
%13 = load i64, i64* %2
%14 = call i8* @llvm.stacksave()
store i8* %14, i8** %3
%15 = alloca i32, i64 %13
store i64 %13, i64* %4
store i64 0, i64* %5
br label %16
16: ; preds = %24, %12
%17 = load i64, i64* %5
%18 = load i64, i64* %2
%19 = icmp ult i64 %17, %18
br i1 %19, label %20, label %27
20: ; preds = %16
%21 = load i64, i64* %5
%22 = getelementptr inbounds i32, i32* %15, i64 %21
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %22)
br label %24
24: ; preds = %20
%25 = load i64, i64* %5
%26 = add i64 %25, 1
store i64 %26, i64* %5
br label %16
27: ; preds = %16
%28 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %6)
%29 = load i64, i64* %2
%30 = load i32, i32* %6
%31 = call i64 @target_n(i64 %29, i32* %15, i32 %30)
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %27
%34 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
br label %35
35: ; preds = %33, %27
%36 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%37 = load i8*, i8** %3
br label %9
38: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"> \00"
@.str.2 = [4 x i8] c"%zu\00"
@.str.3 = [3 x i8] c"%d\00"
@str = [84 x i8] c"Enter the array size, followed by the array elements, followed by the target value.\00"
@str.5 = [12 x i8] c"Impossible.\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i32
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([84 x i8], [84 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%5 = bitcast i64* %1 to i8*
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64* %1)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %35
8: ; preds = %0
%9 = bitcast i32* %2 to i8*
br label %10
10: ; preds = %8, %31
%11 = load i64, i64* %1
%12 = call i8* @llvm.stacksave()
%13 = alloca i32, i64 %11
%14 = load i64, i64* %1
%15 = icmp eq i64 %14, 0
br i1 %15, label %23, label %16
16: ; preds = %10, %16
%17 = phi i64 [ %20, %16 ], [ 0, %10 ]
%18 = getelementptr inbounds i32, i32* %13, i64 %17
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %18)
%20 = add nuw i64 %17, 1
%21 = load i64, i64* %1
%22 = icmp ult i64 %20, %21
br i1 %22, label %16, label %23
23: ; preds = %16, %10
%24 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%25 = load i64, i64* %1
%26 = load i32, i32* %2
%27 = call i64 @target_n(i64 %25, i32* %13, i32 %26)
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %23
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.5, i64 0, i64 0))
br label %31
31: ; preds = %29, %23
%32 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%33 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64* %1)
%34 = icmp eq i32 %33, 1
br i1 %34, label %10, label %35
35: ; preds = %31, %0
ret i32 0
}