#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*/ find_two_repeating(int *, size_t, int *, int *);
int /*<<< orphan*/ printf(char *, ...);
int scanf(char *, ...);
int main(void) {
  static int arr[1024];
  size_t arr_len;
  printf("Enter the size of the array, followed by each element.\n");
  printf("> ");
  while (scanf("%zu", &arr_len) == 1) {
    size_t i;
    for (i = 0; i < arr_len; i++)
      scanf("%d", &arr[i]);
    int a, b;
    find_two_repeating(arr, arr_len, &a, &b);
    printf("%d %d\n> ", a, b);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed6(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    11ee <main+0xbe>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    11bd <main+0x8d>
mov    -0x18(%rbp),%rax
lea    0x2eb9(%rip),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    117e <main+0x4e>
mov    -0x10(%rbp),%rsi
lea    0x2e88(%rip),%rdi
lea    -0x1c(%rbp),%rdx
lea    -0x20(%rbp),%rcx
call   1040 <find_two_repeating@plt>
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    115b <main+0x2b>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xebb(%rip),%rdi
call   1030 <puts@plt>
lea    0xeac(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe91(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmp    $0x1,%eax
jne    1211 <main+0xd1>
lea    0x2ec5(%rip),%r15
lea    0xe6e(%rip),%r13
lea    0x8(%rsp),%rbp
lea    0xe66(%rip),%r14
jmp    11dc <main+0x9c>
xor    %esi,%esi
mov    %r15,%rdi
lea    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
call   1050 <find_two_repeating@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
lea    0xe44(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmp    $0x1,%eax
jne    1211 <main+0xd1>
cmpq   $0x0,0x8(%rsp)
je     11a0 <main+0x60>
mov    %r15,%rbx
xor    %r12d,%r12d
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
add    $0x1,%r12
mov    0x8(%rsp),%rsi
add    $0x4,%rbx
cmp    %rsi,%r12
jb     11f0 <main+0xb0>
jmp    11a2 <main+0x62>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@main.arr = internal global [1024 x i32] zeroinitializer
@.str = [56 x i8] c"Enter the size of the array, followed by each element.\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 = [9 x i8] c"%d %d\0A> \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %23, %0
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64* %2)
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %29
11: ; preds = %8
store i64 0, i64* %3
br label %12
12: ; preds = %20, %11
%13 = load i64, i64* %3
%14 = load i64, i64* %2
%15 = icmp ult i64 %13, %14
br i1 %15, label %16, label %23
16: ; preds = %12
%17 = load i64, i64* %3
%18 = getelementptr inbounds [1024 x i32], [1024 x i32]* @main.arr, i64 0, i64 %17
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %18)
br label %20
20: ; preds = %16
%21 = load i64, i64* %3
%22 = add i64 %21, 1
store i64 %22, i64* %3
br label %12
23: ; preds = %12
%24 = load i64, i64* %2
%25 = call i32 @find_two_repeating(i32* getelementptr inbounds ([1024 x i32], [1024 x i32]* @main.arr, i64 0, i64 0), i64 %24, i32* %4, i32* %5)
%26 = load i32, i32* %4
%27 = load i32, i32* %5
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 %26, i32 %27)
br label %8
29: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@main.arr = internal global [1024 x i32] zeroinitializer
@.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 = [9 x i8] c"%d %d\0A> \00"
@str = [55 x i8] c"Enter the size of the array, followed by each element.\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i64* %1 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64* %1)
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %30
9: ; preds = %0
%10 = bitcast i32* %2 to i8*
%11 = bitcast i32* %3 to i8*
br label %12
12: ; preds = %9, %22
%13 = load i64, i64* %1
%14 = icmp eq i64 %13, 0
br i1 %14, label %22, label %15
15: ; preds = %12, %15
%16 = phi i64 [ %19, %15 ], [ 0, %12 ]
%17 = getelementptr inbounds [1024 x i32], [1024 x i32]* @main.arr, i64 0, i64 %16
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %17)
%19 = add nuw i64 %16, 1
%20 = load i64, i64* %1
%21 = icmp ult i64 %19, %20
br i1 %21, label %15, label %22
22: ; preds = %15, %12
%23 = phi i64 [ 0, %12 ], [ %20, %15 ]
%24 = call i32 @find_two_repeating(i32* getelementptr inbounds ([1024 x i32], [1024 x i32]* @main.arr, i64 0, i64 0), i64 %23, i32* %2, i32* %3)
%25 = load i32, i32* %2
%26 = load i32, i32* %3
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 %25, i32 %26)
%28 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64* %1)
%29 = icmp eq i32 %28, 1
br i1 %29, label %12, label %30
30: ; preds = %22, %0
ret i32 0
}