#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 main(void) {
  int array[8] = {};
  int i;
  for (i = 0; i < 8; i++)
    array[i] = i;
  int m;
  printf("input m:\n");
  m = 3;
  print_last_ele_in_array(array, 8, m);
  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    $0x20,%edx
call   1040 <memset@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0x8,-0x34(%rbp)
jge    1179 <main+0x49>
mov    -0x34(%rbp),%ecx
movslq -0x34(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1156 <main+0x26>
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
movl   $0x3,-0x38(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%edx
mov    $0x8,%esi
call   1050 <print_last_ele_in_array@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps 0xece(%rip),%xmm0
movups %xmm0,0x4(%rsp)
movabs $0x600000005,%rax
mov    %rax,0x14(%rsp)
movl   $0x7,0x1c(%rsp)
lea    0xebb(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rdi
mov    $0x8,%esi
mov    $0x3,%edx
call   1040 <print_last_ele_in_array@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"input m:\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [8 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, 8
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 [8 x i32], [8 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))
store i32 3, i32* %4
%19 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%20 = load i32, i32* %4
%21 = call i32 @print_last_ele_in_array(i32* %19, i32 8, i32 %20)
ret i32 0
}

LLVM IR (-O2):
@str = [9 x i8] c"input m:\00"
define i32 @main() {
%1 = alloca [8 x i32]
%2 = bitcast [8 x i32]* %1 to i8*
%3 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%4 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 1
%5 = bitcast [8 x i32]* %1 to i8*
%6 = bitcast i32* %4 to <4 x i32>*
store <4 x i32> <i32 1, i32 2, i32 3, i32 4>, <4 x i32>* %6
%7 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 5
store i32 5, i32* %7
%8 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 6
store i32 6, i32* %8
%9 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 7
store i32 7, i32* %9
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%11 = call i32 @print_last_ele_in_array(i32* %3, i32 8, i32 3)
ret i32 0
}