#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);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a[10] = {1, 3, 5, 7, 9}, i;
  int data, pos = 0;
  scanf("%d", &data);
  while (pos < 5) {
    if (a[pos] > data)
      break;
    pos++;
  }
  printf("%d\n", pos);
  for (i = 4; i >= pos; i--)
    a[i + 1] = a[i];
  a[pos] = data;
  for (i = 0; i < 6; i++)
    ;
  { printf("%3d", a[i]); }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
movl   $0x1,-0x30(%rbp)
movl   $0x3,-0x2c(%rbp)
movl   $0x5,-0x28(%rbp)
movl   $0x7,-0x24(%rbp)
movl   $0x9,-0x20(%rbp)
movl   $0x0,-0x3c(%rbp)
lea    0xe80(%rip),%rdi
lea    -0x38(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x5,-0x3c(%rbp)
jge    11b7 <main+0x87>
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
cmp    -0x38(%rbp),%eax
jle    11a9 <main+0x79>
jmp    11b7 <main+0x87>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1189 <main+0x59>
mov    -0x3c(%rbp),%esi
lea    0xe42(%rip),%rdi
call   1030 <printf@plt>
movl   $0x4,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jl     11fb <main+0xcb>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%ecx
mov    -0x34(%rbp),%eax
add    $0x1,%eax
cltq
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x34(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x34(%rbp)
jmp    11cd <main+0x9d>
mov    -0x38(%rbp),%ecx
movslq -0x3c(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
movl   $0x0,-0x34(%rbp)
cmpl   $0x6,-0x34(%rbp)
jge    122a <main+0xfa>
jmp    121c <main+0xec>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    120d <main+0xdd>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xdce(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x40,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movq   $0x0,0x30(%rsp)
movaps 0xebc(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movl   $0x9,0x20(%rsp)
lea    0xeb8(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
mov    $0x1,%bpl
test   %eax,%eax
jle    1182 <main+0x62>
cmp    $0x3,%eax
jae    118f <main+0x6f>
mov    $0x1,%ebx
xor    %r14d,%r14d
mov    $0x1,%r12b
mov    $0x1,%r15b
jmp    11c2 <main+0xa2>
xor    %ebx,%ebx
mov    $0x1,%r12b
mov    $0x1,%r15b
mov    $0x1,%r14b
jmp    11c2 <main+0xa2>
cmp    $0x5,%eax
jae    11a1 <main+0x81>
mov    $0x2,%ebx
xor    %r15d,%r15d
mov    $0x1,%r12b
jmp    11bf <main+0x9f>
cmp    $0x7,%eax
jae    11ad <main+0x8d>
mov    $0x3,%ebx
jmp    11b9 <main+0x99>
cmp    $0x9,%eax
jae    120e <main+0xee>
mov    $0x4,%ebx
xor    %ebp,%ebp
xor    %r12d,%r12d
xor    %r15d,%r15d
xor    %r14d,%r14d
lea    0xe4a(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
movl   $0x9,0x24(%rsp)
test   %bpl,%bpl
je     1224 <main+0x104>
mov    0x1c(%rsp),%eax
mov    %eax,0x20(%rsp)
test   %r12b,%r12b
je     1224 <main+0x104>
mov    0x18(%rsp),%eax
mov    %eax,0x1c(%rsp)
test   %r15b,%r15b
je     1224 <main+0x104>
mov    0x14(%rsp),%eax
mov    %eax,0x18(%rsp)
test   %r14b,%r14b
je     1224 <main+0x104>
mov    0x10(%rsp),%eax
mov    %eax,0x14(%rsp)
jmp    1224 <main+0x104>
lea    0xdfe(%rip),%rdi
mov    $0x5,%ebx
mov    $0x5,%esi
call   1030 <printf@plt>
mov    %ebx,%eax
mov    0xc(%rsp),%ecx
mov    %ecx,0x10(%rsp,%rax,4)
mov    0x28(%rsp),%esi
lea    0xdde(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [4 x i8] c"%3d\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = alloca i32
%3 = bitcast [10 x i32]* %1 to i8*
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%5 = bitcast i32* %4 to i8*
%6 = bitcast [10 x i32]* %1 to <4 x i32>*
store <4 x i32> <i32 1, i32 3, i32 5, i32 7>, <4 x i32>* %6
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
store i32 9, i32* %7
%8 = bitcast i32* %2 to i8*
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 1
br i1 %11, label %22, label %12
12: ; preds = %0
%13 = icmp ult i32 %10, 3
br i1 %13, label %22, label %14
14: ; preds = %12
%15 = icmp ult i32 %10, 5
br i1 %15, label %22, label %16
16: ; preds = %14
%17 = icmp ult i32 %10, 7
br i1 %17, label %22, label %18
18: ; preds = %16
%19 = icmp ult i32 %10, 9
br i1 %19, label %22, label %20
20: ; preds = %18
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 5)
br label %46
22: ; preds = %18, %16, %14, %12, %0
%23 = phi i1 [ false, %18 ], [ true, %16 ], [ true, %14 ], [ true, %12 ], [ true, %0 ]
%24 = phi i1 [ false, %18 ], [ false, %16 ], [ true, %14 ], [ true, %12 ], [ true, %0 ]
%25 = phi i1 [ false, %18 ], [ false, %16 ], [ false, %14 ], [ true, %12 ], [ true, %0 ]
%26 = phi i1 [ false, %18 ], [ false, %16 ], [ false, %14 ], [ false, %12 ], [ true, %0 ]
%27 = phi i32 [ 4, %18 ], [ 3, %16 ], [ 2, %14 ], [ 1, %12 ], [ 0, %0 ]
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %27)
%29 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
store i32 9, i32* %29
br i1 %23, label %30, label %46
30: ; preds = %22
%31 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%32 = load i32, i32* %31
%33 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
store i32 %32, i32* %33
br i1 %24, label %34, label %46
34: ; preds = %30
%35 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%36 = load i32, i32* %35
%37 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
store i32 %36, i32* %37
br i1 %25, label %38, label %46
38: ; preds = %34
%39 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%40 = load i32, i32* %39
%41 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
store i32 %40, i32* %41
br i1 %26, label %42, label %46
42: ; preds = %38
%43 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%44 = load i32, i32* %43
%45 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
store i32 %44, i32* %45
br label %46
46: ; preds = %30, %34, %38, %42, %22, %20
%47 = phi i32 [ 5, %20 ], [ %27, %22 ], [ %27, %42 ], [ %27, %38 ], [ %27, %34 ], [ %27, %30 ]
%48 = zext i32 %47 to i64
%49 = load i32, i32* %2
%50 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %48
store i32 %49, i32* %50
%51 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%52 = load i32, i32* %51
%53 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %52)
ret i32 0
}