#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 abs(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i;
  int A[10] = {1, 76, -20, 90, -32, 72, 85, 100, 45, 12}, B[10] = {0}, x, min,
      index;
  scanf("%d", &x);
  for (i = 0; i < 10; i++) {
    B[i] = abs(A[i] - x);
  }
  min = B[0];
  index = 0;
  for (i = 0; i < 10; i++) {
    if (min > B[i + 1]) {
      min = B[i + 1];
      index = i + 1;
    }
  }
  printf("%d", A[index]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xe96(%rip),%rsi
mov    $0x28,%edx
call   1060 <memcpy@plt>
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
lea    0xe9d(%rip),%rdi
lea    -0x64(%rbp),%rsi
call   1070 <scanf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    11cd <main+0x7d>
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edi
sub    -0x64(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,%ecx
movslq -0x8(%rbp),%rax
mov    %ecx,-0x60(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    119b <main+0x4b>
mov    -0x60(%rbp),%eax
mov    %eax,-0x68(%rbp)
movl   $0x0,-0x6c(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    122c <main+0xdc>
mov    -0x68(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
cmp    -0x60(%rbp,%rcx,4),%eax
jle    1219 <main+0xc9>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x60(%rbp,%rax,4),%eax
mov    %eax,-0x68(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    121e <main+0xce>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11e1 <main+0x91>
movslq -0x6c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xded(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.A = [10 x i32] [i32 1, i32 76, i32 -20, i32 90, i32 -32, i32 72, i32 85, i32 100, i32 45, i32 12]
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x i32]
%4 = alloca [10 x i32]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = bitcast [10 x i32]* %3 to i8*
%9 = bitcast [10 x i32]* %4 to i8*
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
store i32 0, i32* %2
br label %11
11: ; preds = %25, %0
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 10
br i1 %13, label %14, label %28
14: ; preds = %11
%15 = load i32, i32* %2
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %16
%18 = load i32, i32* %17
%19 = load i32, i32* %5
%20 = sub nsw i32 %18, %19
%21 = call i32 @abs(i32 %20)
%22 = load i32, i32* %2
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %23
store i32 %21, i32* %24
br label %25
25: ; preds = %14
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 1
store i32 %27, i32* %2
br label %11
28: ; preds = %11
%29 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 0
%30 = load i32, i32* %29
store i32 %30, i32* %6
store i32 0, i32* %7
store i32 0, i32* %2
br label %31
31: ; preds = %51, %28
%32 = load i32, i32* %2
%33 = icmp slt i32 %32, 10
br i1 %33, label %34, label %54
34: ; preds = %31
%35 = load i32, i32* %6
%36 = load i32, i32* %2
%37 = add nsw i32 %36, 1
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %38
%40 = load i32, i32* %39
%41 = icmp sgt i32 %35, %40
br i1 %41, label %42, label %50
42: ; preds = %34
%43 = load i32, i32* %2
%44 = add nsw i32 %43, 1
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %45
%47 = load i32, i32* %46
store i32 %47, i32* %6
%48 = load i32, i32* %2
%49 = add nsw i32 %48, 1
store i32 %49, i32* %7
br label %50
50: ; preds = %42, %34
br label %51
51: ; preds = %50
%52 = load i32, i32* %2
%53 = add nsw i32 %52, 1
store i32 %53, i32* %2
br label %31
54: ; preds = %31
%55 = load i32, i32* %7
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %56
%58 = load i32, i32* %57
%59 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %58)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 undef)
ret i32 0
}