#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i, j, k, c = 0, b;
  int ina[20];
  for (i = 0; i < 20; i++) {
    printf("Type next integer: ");
    scanf("%d", &k);
    b = 0;
    for (j = 0; j < c; j++) {
      if (k == ina[j]) {
        printf("%d\n", k);
        b = 1;
        break;
      }
    }
    if (!b) {
      ina[c] = k;
      c += 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x14,-0x8(%rbp)
jge    11f1 <main+0xd1>
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11c0 <main+0xa0>
mov    -0x10(%rbp),%eax
movslq -0xc(%rbp),%rcx
cmp    -0x70(%rbp,%rcx,4),%eax
jne    11ad <main+0x8d>
mov    -0x10(%rbp),%esi
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x18(%rbp)
jmp    11c0 <main+0xa0>
jmp    11b2 <main+0x92>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1173 <main+0x53>
cmpl   $0x0,-0x18(%rbp)
jne    11de <main+0xbe>
mov    -0x10(%rbp),%ecx
movslq -0x14(%rbp),%rax
mov    %ecx,-0x70(%rbp,%rax,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11e3 <main+0xc3>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113d <main+0x1d>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
lea    0xecb(%rip),%r14
lea    0xed8(%rip),%r15
lea    0xc(%rsp),%r13
lea    0xecf(%rip),%r12
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    1162 <main+0x42>
xchg   %ax,%ax
movslq %ebp,%rax
mov    %esi,0x10(%rsp,%rax,4)
add    $0x1,%ebp
add    $0x1,%ebx
cmp    $0x14,%ebx
je     11bc <main+0x9c>
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
test   %ebp,%ebp
jle    1150 <main+0x30>
mov    %ebp,%eax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    0x10(%rsp,%rcx,4),%esi
je     11b0 <main+0x90>
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1190 <main+0x70>
jmp    1150 <main+0x30>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    115a <main+0x3a>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Type next integer: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [20 x i32]
store i32 0, i32* %1
store i32 0, i32* %5
store i32 0, i32* %2
br label %8
8: ; preds = %43, %0
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 20
br i1 %10, label %11, label %46
11: ; preds = %8
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
store i32 0, i32* %6
store i32 0, i32* %3
br label %14
14: ; preds = %29, %11
%15 = load i32, i32* %3
%16 = load i32, i32* %5
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %32
18: ; preds = %14
%19 = load i32, i32* %4
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [20 x i32], [20 x i32]* %7, i64 0, i64 %21
%23 = load i32, i32* %22
%24 = icmp eq i32 %19, %23
br i1 %24, label %25, label %28
25: ; preds = %18
%26 = load i32, i32* %4
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %26)
store i32 1, i32* %6
br label %32
28: ; preds = %18
br label %29
29: ; preds = %28
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 1
store i32 %31, i32* %3
br label %14
32: ; preds = %25, %14
%33 = load i32, i32* %6
%34 = icmp ne i32 %33, 0
br i1 %34, label %42, label %35
35: ; preds = %32
%36 = load i32, i32* %4
%37 = load i32, i32* %5
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [20 x i32], [20 x i32]* %7, i64 0, i64 %38
store i32 %36, i32* %39
%40 = load i32, i32* %5
%41 = add nsw i32 %40, 1
store i32 %41, i32* %5
br label %42
42: ; preds = %35, %32
br label %43
43: ; preds = %42
%44 = load i32, i32* %2
%45 = add nsw i32 %44, 1
store i32 %45, i32* %2
br label %8
46: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Type next integer: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i32]
%3 = bitcast i32* %1 to i8*
%4 = bitcast [20 x i32]* %2 to i8*
br label %5
5: ; preds = %0, %28
%6 = phi i32 [ 0, %0 ], [ %29, %28 ]
%7 = phi i32 [ 0, %0 ], [ %30, %28 ]
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%10 = icmp sgt i32 %6, 0
%11 = load i32, i32* %1
br i1 %10, label %12, label %24
12: ; preds = %5
%13 = zext i32 %6 to i64
br label %16
14: ; preds = %16
%15 = icmp eq i64 %21, %13
br i1 %15, label %24, label %16
16: ; preds = %12, %14
%17 = phi i64 [ 0, %12 ], [ %21, %14 ]
%18 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 %17
%19 = load i32, i32* %18
%20 = icmp eq i32 %11, %19
%21 = add nuw nsw i64 %17, 1
br i1 %20, label %22, label %14
22: ; preds = %16
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %11)
br label %28
24: ; preds = %14, %5
%25 = sext i32 %6 to i64
%26 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 %25
store i32 %11, i32* %26
%27 = add nsw i32 %6, 1
br label %28
28: ; preds = %22, %24
%29 = phi i32 [ %6, %22 ], [ %27, %24 ]
%30 = add nuw nsw i32 %7, 1
%31 = icmp eq i32 %30, 20
br i1 %31, label %32, label %5
32: ; preds = %28
ret i32 0
}