#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);
void fun1(int *apuntador, int dim) {
  int i;
  for (i = 0; 2 * i + 1 < dim; i++)
    printf("arreglo[%d] = %d\n", 2 * i + 1, *(apuntador + (2 * i + 1)));
}


x86 assembly (clang, -O0):
<fun1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
cmp    -0xc(%rbp),%eax
jge    116e <fun1+0x5e>
mov    -0x10(%rbp),%esi
shl    $0x1,%esi
add    $0x1,%esi
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <fun1+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun1>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%esi
jl     1147 <fun1+0x37>
mov    %esi,%ebx
mov    %rdi,%r14
mov    $0x1,%ebp
lea    0xed3(%rip),%r15
nopl   (%rax)
mov    %ebp,%eax
mov    (%r14,%rax,4),%edx
mov    %r15,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
add    $0x2,%ebp
cmp    %ebx,%ebp
jl     1130 <fun1+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [18 x i8] c"arreglo[%d] = %d\0A\00"
define void @fun1(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 1
br i1 %3, label %4, label %16
4: ; preds = %2, %4
%5 = phi i64 [ %11, %4 ], [ 0, %2 ]
%6 = phi i32 [ %14, %4 ], [ 1, %2 ]
%7 = zext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %9)
%11 = add nuw i64 %5, 1
%12 = trunc i64 %11 to i32
%13 = shl nuw nsw i32 %12, 1
%14 = or i32 %13, 1
%15 = icmp slt i32 %14, %1
br i1 %15, label %4, label %16
16: ; preds = %4, %2
ret void
}