#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*/ prfloatf(char *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  void inv(int *x, int n);
  int i, arr[10], *p = arr;
  printf("the array:\n");
  for (i = 0; i < 10; i++, p++)
    scanf("%d", p);
  printf("\n");
  p = arr;
  inv(p, 10);
  printf("the array:\n");
  for (p = arr; p < arr + 10; p++)
    prfloatf("%d\t", *p);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    119e <main+0x5e>
mov    -0x38(%rbp),%rsi
lea    0xe8d(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x38(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x38(%rbp)
jmp    116a <main+0x2a>
lea    0xe65(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    $0xa,%esi
call   1050 <inv@plt>
lea    0xe39(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
lea    -0x30(%rbp),%rcx
add    $0x28,%rcx
cmp    %rcx,%rax
jae    120c <main+0xcc>
mov    -0x38(%rbp),%rax
mov    (%rax),%esi
lea    0xe19(%rip),%rdi
call   1040 <prfloatf@plt>
mov    -0x38(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x38(%rbp)
jmp    11d4 <main+0x94>
lea    0xdf7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %rsp,%rbx
lea    0xea4(%rip),%r14
mov    %r14,%rdi
call   1040 <puts@plt>
lea    0xe8e(%rip),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
lea    0x4(%rsp),%rsi
mov    %r15,%rdi
call   1070 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %r15,%rdi
call   1070 <scanf@plt>
lea    0xc(%rsp),%rsi
mov    %r15,%rdi
call   1070 <scanf@plt>
lea    0x10(%rsp),%rsi
mov    %r15,%rdi
call   1070 <scanf@plt>
lea    0x14(%rsp),%rsi
mov    %r15,%rdi
call   1070 <scanf@plt>
lea    0x18(%rsp),%rsi
mov    %r15,%rdi
call   1070 <scanf@plt>
lea    0x1c(%rsp),%rsi
mov    %r15,%rdi
call   1070 <scanf@plt>
lea    0x20(%rsp),%rsi
mov    %r15,%rdi
call   1070 <scanf@plt>
lea    0x24(%rsp),%rsi
mov    %r15,%rdi
call   1070 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1060 <inv@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
lea    0x28(%rsp),%r15
lea    0xde6(%rip),%r14
nopl   (%rax)
mov    (%rbx),%esi
mov    %r14,%rdi
call   1050 <prfloatf@plt>
add    $0x4,%rbx
cmp    %r15,%rbx
jb     1220 <main+0xd0>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [12 x i8] c"the array:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [4 x i8] c"%d\09\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x i32]
%4 = alloca i32*
store i32 0, i32* %1
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
store i32* %5, i32** %4
%6 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %7
7: ; preds = %13, %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 10
br i1 %9, label %10, label %18
10: ; preds = %7
%11 = load i32*, i32** %4
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %11)
br label %13
13: ; preds = %10
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
store i32 %15, i32* %2
%16 = load i32*, i32** %4
%17 = getelementptr inbounds i32, i32* %16, i32 1
store i32* %17, i32** %4
br label %7
18: ; preds = %7
%19 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
store i32* %20, i32** %4
%21 = load i32*, i32** %4
%22 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%23 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
store i32* %23, i32** %4
br label %24
24: ; preds = %33, %18
%25 = load i32*, i32** %4
%26 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%27 = getelementptr inbounds i32, i32* %26, i64 10
%28 = icmp ult i32* %25, %27
br i1 %28, label %29, label %36
29: ; preds = %24
%30 = load i32*, i32** %4
%31 = load i32, i32* %30
%32 = call i32 @prfloatf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %31)
br label %33
33: ; preds = %29
%34 = load i32*, i32** %4
%35 = getelementptr inbounds i32, i32* %34, i32 1
store i32* %35, i32** %4
br label %24
36: ; preds = %24
%37 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [4 x i8] c"%d\09\00"
@str.4 = [11 x i8] c"the array:\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.4, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %12)
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %14)
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %16)
%18 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %18)
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %20)
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %22)
%24 = call i32 @putchar(i32 10)
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.4, i64 0, i64 0))
%26 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 10
br label %27
27: ; preds = %0, %27
%28 = phi i32* [ %3, %0 ], [ %31, %27 ]
%29 = load i32, i32* %28
%30 = call i32 @prfloatf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %29)
%31 = getelementptr inbounds i32, i32* %28, i64 1
%32 = icmp ult i32* %31, %26
br i1 %32, label %27, label %33
33: ; preds = %27
%34 = call i32 @putchar(i32 10)
ret i32 0
}