#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 *, ...);
void modificar(int *a) {
  int count;
  printf("\nDesde la funcion, despues de modificar los valores:\n");
  for (count = 0; count < 3; count++) {
    a[count] = 123;
    printf("a[%d] = %d\n", count, a[count]);
  }
}


x86 assembly (clang, -O0):
<modificar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jge    1174 <modificar+0x64>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movl   $0x7b,(%rax,%rcx,4)
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1131 <modificar+0x21>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<modificar>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xede(%rip),%rdi
call   1030 <puts@plt>
movl   $0x7b,(%rbx)
lea    0xec0(%rip),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x7b,%edx
xor    %eax,%eax
call   1040 <printf@plt>
movl   $0x7b,0x4(%rbx)
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x7b,%edx
xor    %eax,%eax
call   1040 <printf@plt>
movl   $0x7b,0x8(%rbx)
mov    %r14,%rdi
mov    $0x2,%esi
mov    $0x7b,%edx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <printf@plt>

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

LLVM IR (-O2):
@.str.1 = [12 x i8] c"a[%d] = %d\0A\00"
@str = [53 x i8] c"\0ADesde la funcion, despues de modificar los valores:\00"
define void @modificar(i32* nocapture writeonly %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str, i64 0, i64 0))
store i32 123, i32* %0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 123)
%4 = getelementptr inbounds i32, i32* %0, i64 1
store i32 123, i32* %4
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 123)
%6 = getelementptr inbounds i32, i32* %0, i64 2
store i32 123, i32* %6
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 123)
ret void
}