#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*/ print_last_ele_in_array(int *, int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int array[20] = {};
  int i;
  for (i = 0; i < 20; i++)
    array[i] = i;
  int m;
  printf("input m:\n");
  scanf("%d", &m);
  print_last_ele_in_array(array, 20, m);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x50,%edx
call   1040 <memset@plt>
movl   $0x0,-0x64(%rbp)
cmpl   $0x14,-0x64(%rbp)
jge    1189 <main+0x49>
mov    -0x64(%rbp),%ecx
movslq -0x64(%rbp),%rax
mov    %ecx,-0x60(%rbp,%rax,4)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1166 <main+0x26>
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
lea    0xe6e(%rip),%rdi
lea    -0x68(%rbp),%rsi
call   1060 <scanf@plt>
lea    -0x60(%rbp),%rdi
mov    -0x68(%rbp),%edx
mov    $0x14,%esi
call   1050 <print_last_ele_in_array@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x68,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebd(%rip),%xmm0
movups %xmm0,0x14(%rsp)
movaps 0xec1(%rip),%xmm0
movups %xmm0,0x24(%rsp)
movaps 0xec5(%rip),%xmm0
movups %xmm0,0x34(%rsp)
movaps 0xec9(%rip),%xmm0
movups %xmm0,0x44(%rsp)
movabs $0x1200000011,%rax
mov    %rax,0x54(%rsp)
movl   $0x13,0x5c(%rsp)
lea    0xeb9(%rip),%rdi
call   1030 <puts@plt>
lea    0xeaa(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%edx
lea    0x10(%rsp),%rdi
mov    $0x14,%esi
call   1040 <print_last_ele_in_array@plt>
xor    %eax,%eax
add    $0x68,%rsp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"input m:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [20 x i32]* %2 to i8*
store i32 0, i32* %3
br label %6
6: ; preds = %14, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 20
br i1 %8, label %9, label %17
9: ; preds = %6
%10 = load i32, i32* %3
%11 = load i32, i32* %3
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 %12
store i32 %10, i32* %13
br label %14
14: ; preds = %9
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %6
17: ; preds = %6
%18 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%20 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%21 = load i32, i32* %4
%22 = call i32 @print_last_ele_in_array(i32* %20, i32 20, i32 %21)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [9 x i8] c"input m:\00"
define i32 @main() {
%1 = alloca [20 x i32]
%2 = alloca i32
%3 = bitcast [20 x i32]* %1 to i8*
%4 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 0
%5 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 1
%6 = bitcast [20 x i32]* %1 to i8*
%7 = bitcast i32* %5 to <4 x i32>*
store <4 x i32> <i32 1, i32 2, i32 3, i32 4>, <4 x i32>* %7
%8 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 5
%9 = bitcast i32* %8 to <4 x i32>*
store <4 x i32> <i32 5, i32 6, i32 7, i32 8>, <4 x i32>* %9
%10 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 9
%11 = bitcast i32* %10 to <4 x i32>*
store <4 x i32> <i32 9, i32 10, i32 11, i32 12>, <4 x i32>* %11
%12 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 13
%13 = bitcast i32* %12 to <4 x i32>*
store <4 x i32> <i32 13, i32 14, i32 15, i32 16>, <4 x i32>* %13
%14 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 17
store i32 17, i32* %14
%15 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 18
store i32 18, i32* %15
%16 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 19
store i32 19, i32* %16
%17 = bitcast i32* %2 to i8*
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%20 = load i32, i32* %2
%21 = call i32 @print_last_ele_in_array(i32* %4, i32 20, i32 %20)
ret i32 0
}