#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*/ delete (int *, int, int);
int find(int *, int, int);
int /*<<< orphan*/ select_sort(int *, int);
void find_two_number_in_array(int *p, int size, int find_num, int *q) {
  int sub;
  int *p_copy = NULL;
  int another;
  select_sort(p, size);
  int i, temp;
  int j = 0;
  for (i = 0; i < size - 1; i++) {
    p_copy = p + i;
    another = 0;
    temp = p_copy[0];
    delete (p_copy, size - i, temp);
    another = find(p_copy, size - i, find_num - temp);
    if (temp + another == find_num) {
      delete (p_copy, size - i - 1, another);
      q[j] = temp;
      q[j + 1] = another;
      q++;
    }
  }
}


x86 assembly (clang, -O0):
<find_two_number_in_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1050 <select_sort@plt>
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    122a <find_two_number_in_array+0xfa>
mov    -0x8(%rbp),%rax
movslq -0x30(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0xc(%rbp),%esi
sub    -0x30(%rbp),%esi
mov    -0x34(%rbp),%edx
call   1040 <delete@plt>
mov    -0x28(%rbp),%rdi
mov    -0xc(%rbp),%esi
sub    -0x30(%rbp),%esi
mov    -0x10(%rbp),%edx
sub    -0x34(%rbp),%edx
call   1030 <find@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x34(%rbp),%eax
add    -0x2c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    1217 <find_two_number_in_array+0xe7>
mov    -0x28(%rbp),%rdi
mov    -0xc(%rbp),%esi
sub    -0x30(%rbp),%esi
sub    $0x1,%esi
mov    -0x2c(%rbp),%edx
call   1040 <delete@plt>
mov    -0x34(%rbp),%edx
mov    -0x18(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x2c(%rbp),%edx
mov    -0x18(%rbp),%rax
mov    -0x38(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x18(%rbp)
jmp    121c <find_two_number_in_array+0xec>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1168 <find_two_number_in_array+0x38>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_two_number_in_array>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,(%rsp)
mov    %edx,%r15d
mov    %esi,%ebx
mov    %rdi,%rbp
call   1050 <select_sort@plt>
cmp    $0x2,%ebx
jl     11bd <find_two_number_in_array+0x8d>
lea    -0x1(%rbx),%r14d
jmp    116d <find_two_number_in_array+0x3d>
nopw   0x0(%rax,%rax,1)
add    $0xffffffff,%ebx
add    $0x4,%rbp
add    $0xffffffffffffffff,%r14
je     11bd <find_two_number_in_array+0x8d>
mov    0x0(%rbp),%r12d
mov    %rbp,%rdi
mov    %ebx,%esi
mov    %r12d,%edx
call   1040 <delete@plt>
mov    %r15d,%edx
sub    %r12d,%edx
mov    %rbp,%rdi
mov    %ebx,%esi
call   1030 <find@plt>
mov    %eax,%r13d
lea    (%r12,%r13,1),%eax
cmp    %r15d,%eax
jne    1160 <find_two_number_in_array+0x30>
lea    -0x1(%rbx),%esi
mov    %rbp,%rdi
mov    %r13d,%edx
call   1040 <delete@plt>
mov    (%rsp),%rax
mov    %r12d,(%rax)
mov    %r13d,0x4(%rax)
add    $0x4,%rax
mov    %rax,(%rsp)
jmp    1160 <find_two_number_in_array+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @find_two_number_in_array(i32* %0, i32 %1, i32 %2, i32* nocapture writeonly %3) {
%5 = tail call i32 @select_sort(i32* %0, i32 %1)
%6 = icmp sgt i32 %1, 1
br i1 %6, label %7, label %30
7: ; preds = %4
%8 = add nsw i32 %1, -1
%9 = zext i32 %8 to i64
br label %10
10: ; preds = %7, %26
%11 = phi i64 [ 0, %7 ], [ %28, %26 ]
%12 = phi i32* [ %3, %7 ], [ %27, %26 ]
%13 = getelementptr inbounds i32, i32* %0, i64 %11
%14 = load i32, i32* %13
%15 = trunc i64 %11 to i32
%16 = sub nsw i32 %1, %15
%17 = tail call i32 @delete(i32* %13, i32 %16, i32 %14)
%18 = sub nsw i32 %2, %14
%19 = tail call i32 @find(i32* %13, i32 %16, i32 %18)
%20 = add nsw i32 %19, %14
%21 = icmp eq i32 %20, %2
br i1 %21, label %22, label %26
22: ; preds = %10
%23 = add nsw i32 %16, -1
%24 = tail call i32 @delete(i32* %13, i32 %23, i32 %19)
store i32 %14, i32* %12
%25 = getelementptr inbounds i32, i32* %12, i64 1
store i32 %19, i32* %25
br label %26
26: ; preds = %10, %22
%27 = phi i32* [ %25, %22 ], [ %12, %10 ]
%28 = add nuw nsw i64 %11, 1
%29 = icmp eq i64 %28, %9
br i1 %29, label %30, label %10
30: ; preds = %26, %4
ret void
}