#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() {
  void move(int[20], int, int);
  int number[20], n, m, i;
  printf("how many numbers?");
  scanf("%d", &n);
  printf("input %d numbers:\n", n);
  for (i = 0; i < n; i++)
    scanf("%d", &number[i]);
  printf("how many place you want move?");
  scanf("%d", &m);
  move(number, n, m);
  printf("sorted order:\n");
  for (i = 0; i < n; i++)
    printf("%d  ", number[i]);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebe(%rip),%rdi
lea    -0x64(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x64(%rbp),%esi
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0x64(%rbp),%eax
jge    11aa <main+0x7a>
movslq -0x6c(%rbp),%rax
lea    -0x60(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe7b(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    1175 <main+0x45>
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe53(%rip),%rdi
lea    -0x68(%rbp),%rsi
call   1040 <scanf@plt>
lea    -0x60(%rbp),%rdi
mov    -0x64(%rbp),%esi
mov    -0x68(%rbp),%edx
call   1050 <move@plt>
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0x64(%rbp),%eax
jge    121c <main+0xec>
movslq -0x6c(%rbp),%rax
mov    -0x60(%rbp,%rax,4),%esi
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    11ec <main+0xbc>
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x60,%rsp
lea    0xea0(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xea4(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x8(%rsp),%esi
lea    0xe92(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmpl   $0x0,0x8(%rsp)
jle    11bd <main+0x6d>
lea    0x10(%rsp),%r15
xor    %ebx,%ebx
lea    0xe73(%rip),%r14
nop
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
add    $0x1,%rbx
movslq 0x8(%rsp),%rax
add    $0x4,%r15
cmp    %rax,%rbx
jl     11a0 <main+0x50>
lea    0xe64(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe40(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x8(%rsp),%esi
mov    0xc(%rsp),%edx
lea    0x10(%rsp),%rdi
call   1070 <move@plt>
lea    0xe56(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x0,0x8(%rsp)
jle    122c <main+0xdc>
lea    0xe3e(%rip),%r14
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    0x10(%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
movslq 0x8(%rsp),%rax
cmp    %rax,%rbx
jl     1210 <main+0xc0>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [18 x i8] c"how many numbers?\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [19 x i8] c"input %d numbers:\0A\00"
@.str.3 = [30 x i8] c"how many place you want move?\00"
@.str.5 = [5 x i8] c"%d \00"
@str = [14 x i8] c"sorted order:\00"
define i32 @main() {
%1 = alloca [20 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = bitcast [20 x i32]* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %2
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %21
13: ; preds = %0, %13
%14 = phi i64 [ %17, %13 ], [ 0, %0 ]
%15 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 %14
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %15)
%17 = add nuw nsw i64 %14, 1
%18 = load i32, i32* %2
%19 = sext i32 %18 to i64
%20 = icmp slt i64 %17, %19
br i1 %20, label %13, label %21
21: ; preds = %13, %0
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%24 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 0
%25 = load i32, i32* %2
%26 = load i32, i32* %3
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%28 = load i32, i32* %2
%29 = icmp sgt i32 %28, 0
br i1 %29, label %30, label %39
30: ; preds = %21, %30
%31 = phi i64 [ %35, %30 ], [ 0, %21 ]
%32 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %33)
%35 = add nuw nsw i64 %31, 1
%36 = load i32, i32* %2
%37 = sext i32 %36 to i64
%38 = icmp slt i64 %35, %37
br i1 %38, label %30, label %39
39: ; preds = %30, %21
%40 = call i32 @putchar(i32 10)
ret i32 0
}