#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 omp_get_max_threads();
int /*<<< orphan*/ omp_set_num_threads(int);
void inicializar_vector(int *vector) {
  int i;
  int nthreads_max = omp_get_max_threads();
  omp_set_num_threads(nthreads_max);
#pragma opm parallel for private(i) schedule(auto)
  {
    for (i = 0; i < 100000000; i++)
      vector[i] = 1;
  }
}


x86 assembly (clang, -O0):
<inicializar_vector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <omp_get_max_threads@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <omp_set_num_threads@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x5f5e100,-0xc(%rbp)
jge    116f <inicializar_vector+0x4f>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1145 <inicializar_vector+0x25>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inicializar_vector>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <omp_get_max_threads@plt>
mov    %eax,%edi
call   1030 <omp_set_num_threads@plt>
mov    $0x3c,%eax
movaps 0xec2(%rip),%xmm0
xchg   %ax,%ax
movups %xmm0,-0xf0(%rbx,%rax,4)
ff
movups %xmm0,-0xe0(%rbx,%rax,4)
ff
movups %xmm0,-0xd0(%rbx,%rax,4)
ff
movups %xmm0,-0xc0(%rbx,%rax,4)
ff
movups %xmm0,-0xb0(%rbx,%rax,4)
ff
movups %xmm0,-0xa0(%rbx,%rax,4)
ff
movups %xmm0,-0x90(%rbx,%rax,4)
ff
movups %xmm0,-0x80(%rbx,%rax,4)
movups %xmm0,-0x70(%rbx,%rax,4)
movups %xmm0,-0x60(%rbx,%rax,4)
movups %xmm0,-0x50(%rbx,%rax,4)
movups %xmm0,-0x40(%rbx,%rax,4)
movups %xmm0,-0x30(%rbx,%rax,4)
movups %xmm0,-0x20(%rbx,%rax,4)
movups %xmm0,-0x10(%rbx,%rax,4)
movups %xmm0,(%rbx,%rax,4)
add    $0x40,%rax
cmp    $0x5f5e13c,%rax
jne    1140 <inicializar_vector+0x20>
pop    %rbx
ret

LLVM IR (-O0):
define void @inicializar_vector(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
%5 = call i32 (...) @omp_get_max_threads()
store i32 %5, i32* %4
%6 = load i32, i32* %4
%7 = call i32 @omp_set_num_threads(i32 %6)
store i32 0, i32* %3
br label %8
8: ; preds = %16, %1
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 100000000
br i1 %10, label %11, label %19
11: ; preds = %8
%12 = load i32*, i32** %2
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
store i32 1, i32* %15
br label %16
16: ; preds = %11
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %8
19: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @inicializar_vector(i32* nocapture writeonly %0) {
%2 = tail call i32 (...) @omp_get_max_threads()
%3 = tail call i32 @omp_set_num_threads(i32 %2)
br label %4
4: ; preds = %4, %1
%5 = phi i64 [ 0, %1 ], [ %45, %4 ]
%6 = getelementptr inbounds i32, i32* %0, i64 %5
%7 = bitcast i32* %6 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %7
%8 = getelementptr inbounds i32, i32* %6, i64 4
%9 = bitcast i32* %8 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %9
%10 = or i64 %5, 8
%11 = getelementptr inbounds i32, i32* %0, i64 %10
%12 = bitcast i32* %11 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %12
%13 = getelementptr inbounds i32, i32* %11, i64 4
%14 = bitcast i32* %13 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %14
%15 = or i64 %5, 16
%16 = getelementptr inbounds i32, i32* %0, i64 %15
%17 = bitcast i32* %16 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %17
%18 = getelementptr inbounds i32, i32* %16, i64 4
%19 = bitcast i32* %18 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %19
%20 = or i64 %5, 24
%21 = getelementptr inbounds i32, i32* %0, i64 %20
%22 = bitcast i32* %21 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %22
%23 = getelementptr inbounds i32, i32* %21, i64 4
%24 = bitcast i32* %23 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %24
%25 = or i64 %5, 32
%26 = getelementptr inbounds i32, i32* %0, i64 %25
%27 = bitcast i32* %26 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %27
%28 = getelementptr inbounds i32, i32* %26, i64 4
%29 = bitcast i32* %28 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %29
%30 = or i64 %5, 40
%31 = getelementptr inbounds i32, i32* %0, i64 %30
%32 = bitcast i32* %31 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %32
%33 = getelementptr inbounds i32, i32* %31, i64 4
%34 = bitcast i32* %33 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %34
%35 = or i64 %5, 48
%36 = getelementptr inbounds i32, i32* %0, i64 %35
%37 = bitcast i32* %36 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %37
%38 = getelementptr inbounds i32, i32* %36, i64 4
%39 = bitcast i32* %38 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %39
%40 = or i64 %5, 56
%41 = getelementptr inbounds i32, i32* %0, i64 %40
%42 = bitcast i32* %41 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %42
%43 = getelementptr inbounds i32, i32* %41, i64 4
%44 = bitcast i32* %43 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %44
%45 = add nuw nsw i64 %5, 64
%46 = icmp eq i64 %45, 100000000
br i1 %46, label %47, label %4
47: ; preds = %4
ret void
}