#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*/ pthread_exit(int /*<<< orphan*/ *);
float sigmoid(float);
void *threadMain() {
  float data[100000];
  for (long long i = 0; i < 100000; i++) {
    data[i] = (float)i;
  }
  for (long long i = 0; i < 100000 / 10000; i++) {
    for (long long j = 0; j < 100000; j++) {
      data[j] = sigmoid(data[j]);
    }
  }
  pthread_exit(NULL);
}


x86 assembly (clang, -O0):
<threadMain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x61ab0,%rsp
movq   $0x0,-0x61a98(%rbp)
cmpq   $0x186a0,-0x61a98(%rbp)
jge    1177 <threadMain+0x57>
cvtsi2ssq -0x61a98(%rbp),%xmm0
f9 ff
mov    -0x61a98(%rbp),%rax
movss  %xmm0,-0x61a90(%rbp,%rax,4)
f9 ff
mov    -0x61a98(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x61a98(%rbp)
jmp    1136 <threadMain+0x16>
movq   $0x0,-0x61aa0(%rbp)
cmpq   $0xa,-0x61aa0(%rbp)
0a
jge    1204 <threadMain+0xe4>
movq   $0x0,-0x61aa8(%rbp)
cmpq   $0x186a0,-0x61aa8(%rbp)
jge    11e8 <threadMain+0xc8>
mov    -0x61aa8(%rbp),%rax
movss  -0x61a90(%rbp,%rax,4),%xmm0
f9 ff
call   1030 <sigmoid@plt>
mov    -0x61aa8(%rbp),%rax
movss  %xmm0,-0x61a90(%rbp,%rax,4)
f9 ff
mov    -0x61aa8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x61aa8(%rbp)
jmp    119b <threadMain+0x7b>
jmp    11ed <threadMain+0xcd>
mov    -0x61aa0(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x61aa0(%rbp)
jmp    1182 <threadMain+0x62>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x61ab0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<threadMain>:
push   %rbx
sub    $0x61a80,%rsp
movdqa 0xed0(%rip),%xmm0
movdqa 0xed8(%rip),%xmm1
mov    $0x10,%eax
movdqa 0xeda(%rip),%xmm8
movdqa 0xee1(%rip),%xmm9
movdqa 0xee8(%rip),%xmm10
movdqa 0xef0(%rip),%xmm5
movdqa 0xef8(%rip),%xmm6
nopl   0x0(%rax,%rax,1)
movq   %xmm1,%rcx
xorps  %xmm7,%xmm7
cvtsi2ss %rcx,%xmm7
pshufd $0xee,%xmm1,%xmm2
movq   %xmm2,%rcx
xorps  %xmm2,%xmm2
cvtsi2ss %rcx,%xmm2
movq   %xmm0,%rcx
xorps  %xmm3,%xmm3
cvtsi2ss %rcx,%xmm3
pshufd $0xee,%xmm0,%xmm4
movq   %xmm4,%rcx
xorps  %xmm4,%xmm4
cvtsi2ss %rcx,%xmm4
unpcklps %xmm2,%xmm7
unpcklps %xmm4,%xmm3
movlhps %xmm3,%xmm7
movdqa %xmm1,%xmm2
paddq  %xmm8,%xmm2
movq   %xmm2,%rcx
xorps  %xmm3,%xmm3
cvtsi2ss %rcx,%xmm3
movaps %xmm7,-0x40(%rsp,%rax,4)
movdqa %xmm0,%xmm4
paddq  %xmm8,%xmm4
pshufd $0xee,%xmm2,%xmm2
movq   %xmm2,%rcx
xorps  %xmm2,%xmm2
cvtsi2ss %rcx,%xmm2
movq   %xmm4,%rcx
xorps  %xmm7,%xmm7
cvtsi2ss %rcx,%xmm7
pshufd $0xee,%xmm4,%xmm4
movq   %xmm4,%rcx
xorps  %xmm4,%xmm4
cvtsi2ss %rcx,%xmm4
unpcklps %xmm2,%xmm3
unpcklps %xmm4,%xmm7
movlhps %xmm7,%xmm3
movdqa %xmm1,%xmm2
paddq  %xmm9,%xmm2
movq   %xmm2,%rcx
xorps  %xmm4,%xmm4
cvtsi2ss %rcx,%xmm4
movaps %xmm3,-0x30(%rsp,%rax,4)
movdqa %xmm0,%xmm3
paddq  %xmm9,%xmm3
pshufd $0xee,%xmm2,%xmm2
movq   %xmm2,%rcx
xorps  %xmm2,%xmm2
cvtsi2ss %rcx,%xmm2
movq   %xmm3,%rcx
xorps  %xmm7,%xmm7
cvtsi2ss %rcx,%xmm7
pshufd $0xee,%xmm3,%xmm3
movq   %xmm3,%rcx
xorps  %xmm3,%xmm3
cvtsi2ss %rcx,%xmm3
unpcklps %xmm2,%xmm4
unpcklps %xmm3,%xmm7
movlhps %xmm7,%xmm4
movdqa %xmm1,%xmm2
paddq  %xmm10,%xmm2
movq   %xmm2,%rcx
xorps  %xmm3,%xmm3
cvtsi2ss %rcx,%xmm3
movaps %xmm4,-0x20(%rsp,%rax,4)
movdqa %xmm0,%xmm4
paddq  %xmm10,%xmm4
pshufd $0xee,%xmm2,%xmm2
movq   %xmm2,%rcx
xorps  %xmm2,%xmm2
cvtsi2ss %rcx,%xmm2
movq   %xmm4,%rcx
xorps  %xmm7,%xmm7
cvtsi2ss %rcx,%xmm7
pshufd $0xee,%xmm4,%xmm4
movq   %xmm4,%rcx
xorps  %xmm4,%xmm4
cvtsi2ss %rcx,%xmm4
unpcklps %xmm2,%xmm3
unpcklps %xmm4,%xmm7
movlhps %xmm7,%xmm3
movdqa %xmm1,%xmm2
paddq  %xmm5,%xmm2
movq   %xmm2,%rcx
xorps  %xmm4,%xmm4
cvtsi2ss %rcx,%xmm4
movaps %xmm3,-0x10(%rsp,%rax,4)
movdqa %xmm0,%xmm3
paddq  %xmm5,%xmm3
pshufd $0xee,%xmm2,%xmm2
movq   %xmm2,%rcx
xorps  %xmm2,%xmm2
cvtsi2ss %rcx,%xmm2
movq   %xmm3,%rcx
xorps  %xmm7,%xmm7
cvtsi2ss %rcx,%xmm7
pshufd $0xee,%xmm3,%xmm3
movq   %xmm3,%rcx
xorps  %xmm3,%xmm3
cvtsi2ss %rcx,%xmm3
unpcklps %xmm2,%xmm4
unpcklps %xmm3,%xmm7
movlhps %xmm7,%xmm4
movaps %xmm4,(%rsp,%rax,4)
paddq  %xmm6,%xmm1
paddq  %xmm6,%xmm0
add    $0x14,%rax
cmp    $0x186b0,%rax
jne    1170 <threadMain+0x50>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movd   (%rsp,%rbx,4),%xmm0
call   1030 <sigmoid@plt>
movd   %xmm0,(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    $0x186a0,%rbx
jne    1350 <threadMain+0x230>
xor    %ebx,%ebx
xchg   %ax,%ax
movd   (%rsp,%rbx,4),%xmm0
call   1030 <sigmoid@plt>
movd   %xmm0,(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    $0x186a0,%rbx
jne    1370 <threadMain+0x250>
xor    %ebx,%ebx
xchg   %ax,%ax
movd   (%rsp,%rbx,4),%xmm0
call   1030 <sigmoid@plt>
movd   %xmm0,(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    $0x186a0,%rbx
jne    1390 <threadMain+0x270>
xor    %ebx,%ebx
xchg   %ax,%ax
movd   (%rsp,%rbx,4),%xmm0
call   1030 <sigmoid@plt>
movd   %xmm0,(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    $0x186a0,%rbx
jne    13b0 <threadMain+0x290>
xor    %ebx,%ebx
xchg   %ax,%ax
movd   (%rsp,%rbx,4),%xmm0
call   1030 <sigmoid@plt>
movd   %xmm0,(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    $0x186a0,%rbx
jne    13d0 <threadMain+0x2b0>
xor    %ebx,%ebx
xchg   %ax,%ax
movd   (%rsp,%rbx,4),%xmm0
call   1030 <sigmoid@plt>
movd   %xmm0,(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    $0x186a0,%rbx
jne    13f0 <threadMain+0x2d0>
xor    %ebx,%ebx
xchg   %ax,%ax
movd   (%rsp,%rbx,4),%xmm0
call   1030 <sigmoid@plt>
movd   %xmm0,(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    $0x186a0,%rbx
jne    1410 <threadMain+0x2f0>
xor    %ebx,%ebx
xchg   %ax,%ax
movd   (%rsp,%rbx,4),%xmm0
call   1030 <sigmoid@plt>
movd   %xmm0,(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    $0x186a0,%rbx
jne    1430 <threadMain+0x310>
xor    %ebx,%ebx
xchg   %ax,%ax
movd   (%rsp,%rbx,4),%xmm0
call   1030 <sigmoid@plt>
movd   %xmm0,(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    $0x186a0,%rbx
jne    1450 <threadMain+0x330>
xor    %ebx,%ebx
xchg   %ax,%ax
movd   (%rsp,%rbx,4),%xmm0
call   1030 <sigmoid@plt>
movd   %xmm0,(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    $0x186a0,%rbx
jne    1470 <threadMain+0x350>
xor    %edi,%edi
add    $0x61a80,%rsp
pop    %rbx
jmp    1040 <pthread_exit@plt>

LLVM IR (-O0):
define i8* @threadMain() {
%1 = alloca i8*
%2 = alloca [100000 x float]
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 0, i64* %3
br label %6
6: ; preds = %14, %0
%7 = load i64, i64* %3
%8 = icmp slt i64 %7, 100000
br i1 %8, label %9, label %17
9: ; preds = %6
%10 = load i64, i64* %3
%11 = sitofp i64 %10 to float
%12 = load i64, i64* %3
%13 = getelementptr inbounds [100000 x float], [100000 x float]* %2, i64 0, i64 %12
store float %11, float* %13
br label %14
14: ; preds = %9
%15 = load i64, i64* %3
%16 = add nsw i64 %15, 1
store i64 %16, i64* %3
br label %6
17: ; preds = %6
store i64 0, i64* %4
br label %18
18: ; preds = %36, %17
%19 = load i64, i64* %4
%20 = icmp slt i64 %19, 10
br i1 %20, label %21, label %39
21: ; preds = %18
store i64 0, i64* %5
br label %22
22: ; preds = %32, %21
%23 = load i64, i64* %5
%24 = icmp slt i64 %23, 100000
br i1 %24, label %25, label %35
25: ; preds = %22
%26 = load i64, i64* %5
%27 = getelementptr inbounds [100000 x float], [100000 x float]* %2, i64 0, i64 %26
%28 = load float, float* %27
%29 = call float @sigmoid(float %28)
%30 = load i64, i64* %5
%31 = getelementptr inbounds [100000 x float], [100000 x float]* %2, i64 0, i64 %30
store float %29, float* %31
br label %32
32: ; preds = %25
%33 = load i64, i64* %5
%34 = add nsw i64 %33, 1
store i64 %34, i64* %5
br label %22
35: ; preds = %22
br label %36
36: ; preds = %35
%37 = load i64, i64* %4
%38 = add nsw i64 %37, 1
store i64 %38, i64* %4
br label %18
39: ; preds = %18
%40 = call i32 @pthread_exit(i32* null)
%41 = load i8*, i8** %1
ret i8* %41
}

LLVM IR (-O2):
define noalias i8* @threadMain() {
%1 = alloca [100000 x float]
%2 = bitcast [100000 x float]* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = phi i64 [ 0, %0 ], [ %29, %3 ]
%5 = phi <4 x i64> [ <i64 0, i64 1, i64 2, i64 3>, %0 ], [ %30, %3 ]
%6 = sitofp <4 x i64> %5 to <4 x float>
%7 = getelementptr inbounds [100000 x float], [100000 x float]* %1, i64 0, i64 %4
%8 = bitcast float* %7 to <4 x float>*
store <4 x float> %6, <4 x float>* %8
%9 = add nuw nsw i64 %4, 4
%10 = add <4 x i64> %5, <i64 4, i64 4, i64 4, i64 4>
%11 = sitofp <4 x i64> %10 to <4 x float>
%12 = getelementptr inbounds [100000 x float], [100000 x float]* %1, i64 0, i64 %9
%13 = bitcast float* %12 to <4 x float>*
store <4 x float> %11, <4 x float>* %13
%14 = add nuw nsw i64 %4, 8
%15 = add <4 x i64> %5, <i64 8, i64 8, i64 8, i64 8>
%16 = sitofp <4 x i64> %15 to <4 x float>
%17 = getelementptr inbounds [100000 x float], [100000 x float]* %1, i64 0, i64 %14
%18 = bitcast float* %17 to <4 x float>*
store <4 x float> %16, <4 x float>* %18
%19 = add nuw nsw i64 %4, 12
%20 = add <4 x i64> %5, <i64 12, i64 12, i64 12, i64 12>
%21 = sitofp <4 x i64> %20 to <4 x float>
%22 = getelementptr inbounds [100000 x float], [100000 x float]* %1, i64 0, i64 %19
%23 = bitcast float* %22 to <4 x float>*
store <4 x float> %21, <4 x float>* %23
%24 = add nuw nsw i64 %4, 16
%25 = add <4 x i64> %5, <i64 16, i64 16, i64 16, i64 16>
%26 = sitofp <4 x i64> %25 to <4 x float>
%27 = getelementptr inbounds [100000 x float], [100000 x float]* %1, i64 0, i64 %24
%28 = bitcast float* %27 to <4 x float>*
store <4 x float> %26, <4 x float>* %28
%29 = add nuw nsw i64 %4, 20
%30 = add <4 x i64> %5, <i64 20, i64 20, i64 20, i64 20>
%31 = icmp eq i64 %29, 100000
br i1 %31, label %97, label %3
32: ; preds = %97, %32
%33 = phi i64 [ %37, %32 ], [ 0, %97 ]
%34 = getelementptr inbounds [100000 x float], [100000 x float]* %1, i64 0, i64 %33
%35 = load float, float* %34
%36 = tail call float @sigmoid(float %35)
store float %36, float* %34
%37 = add nuw nsw i64 %33, 1
%38 = icmp eq i64 %37, 100000
br i1 %38, label %39, label %32
39: ; preds = %32, %39
%40 = phi i64 [ %44, %39 ], [ 0, %32 ]
%41 = getelementptr inbounds [100000 x float], [100000 x float]* %1, i64 0, i64 %40
%42 = load float, float* %41
%43 = tail call float @sigmoid(float %42)
store float %43, float* %41
%44 = add nuw nsw i64 %40, 1
%45 = icmp eq i64 %44, 100000
br i1 %45, label %46, label %39
46: ; preds = %39, %46
%47 = phi i64 [ %51, %46 ], [ 0, %39 ]
%48 = getelementptr inbounds [100000 x float], [100000 x float]* %1, i64 0, i64 %47
%49 = load float, float* %48
%50 = tail call float @sigmoid(float %49)
store float %50, float* %48
%51 = add nuw nsw i64 %47, 1
%52 = icmp eq i64 %51, 100000
br i1 %52, label %53, label %46
53: ; preds = %46, %53
%54 = phi i64 [ %58, %53 ], [ 0, %46 ]
%55 = getelementptr inbounds [100000 x float], [100000 x float]* %1, i64 0, i64 %54
%56 = load float, float* %55
%57 = tail call float @sigmoid(float %56)
store float %57, float* %55
%58 = add nuw nsw i64 %54, 1
%59 = icmp eq i64 %58, 100000
br i1 %59, label %60, label %53
60: ; preds = %53, %60
%61 = phi i64 [ %65, %60 ], [ 0, %53 ]
%62 = getelementptr inbounds [100000 x float], [100000 x float]* %1, i64 0, i64 %61
%63 = load float, float* %62
%64 = tail call float @sigmoid(float %63)
store float %64, float* %62
%65 = add nuw nsw i64 %61, 1
%66 = icmp eq i64 %65, 100000
br i1 %66, label %67, label %60
67: ; preds = %60, %67
%68 = phi i64 [ %72, %67 ], [ 0, %60 ]
%69 = getelementptr inbounds [100000 x float], [100000 x float]* %1, i64 0, i64 %68
%70 = load float, float* %69
%71 = tail call float @sigmoid(float %70)
store float %71, float* %69
%72 = add nuw nsw i64 %68, 1
%73 = icmp eq i64 %72, 100000
br i1 %73, label %74, label %67
74: ; preds = %67, %74
%75 = phi i64 [ %79, %74 ], [ 0, %67 ]
%76 = getelementptr inbounds [100000 x float], [100000 x float]* %1, i64 0, i64 %75
%77 = load float, float* %76
%78 = tail call float @sigmoid(float %77)
store float %78, float* %76
%79 = add nuw nsw i64 %75, 1
%80 = icmp eq i64 %79, 100000
br i1 %80, label %81, label %74
81: ; preds = %74, %81
%82 = phi i64 [ %86, %81 ], [ 0, %74 ]
%83 = getelementptr inbounds [100000 x float], [100000 x float]* %1, i64 0, i64 %82
%84 = load float, float* %83
%85 = tail call float @sigmoid(float %84)
store float %85, float* %83
%86 = add nuw nsw i64 %82, 1
%87 = icmp eq i64 %86, 100000
br i1 %87, label %88, label %81
88: ; preds = %81, %88
%89 = phi i64 [ %93, %88 ], [ 0, %81 ]
%90 = getelementptr inbounds [100000 x float], [100000 x float]* %1, i64 0, i64 %89
%91 = load float, float* %90
%92 = tail call float @sigmoid(float %91)
store float %92, float* %90
%93 = add nuw nsw i64 %89, 1
%94 = icmp eq i64 %93, 100000
br i1 %94, label %95, label %88
95: ; preds = %88
%96 = tail call i32 @pthread_exit(i32* null)
ret i8* undef
97: ; preds = %3, %97
%98 = phi i64 [ %102, %97 ], [ 0, %3 ]
%99 = getelementptr inbounds [100000 x float], [100000 x float]* %1, i64 0, i64 %98
%100 = load float, float* %99
%101 = tail call float @sigmoid(float %100)
store float %101, float* %99
%102 = add nuw nsw i64 %98, 1
%103 = icmp eq i64 %102, 100000
br i1 %103, label %32, label %97
}