#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*/ abort();
int main(void) {
  long double d = .0L;
  int i;
#pragma omp parallel for shared(d)
  for (i = 0; i < 1000; i++)
#pragma omp atomic
    d += 1.0L;
  if (d != 1000.0L)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
fldz
fstpt  -0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x3e8,-0x24(%rbp)
jge    1150 <main+0x40>
fldt   -0x20(%rbp)
fld1
faddp  %st,%st(1)
fstpt  -0x20(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    112b <main+0x1b>
fldt   -0x20(%rbp)
flds   0xea7(%rip)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jne    1170 <main+0x60>
jp     1170 <main+0x60>
jmp    1177 <main+0x67>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
fldz
mov    $0x3e8,%eax
fld1
nopw   0x0(%rax,%rax,1)
fadd   %st,%st(1)
fadd   %st,%st(1)
fadd   %st,%st(1)
fadd   %st,%st(1)
fadd   %st,%st(1)
fadd   %st,%st(1)
fadd   %st,%st(1)
fadd   %st,%st(1)
fadd   %st,%st(1)
fadd   %st,%st(1)
add    $0xfffffff6,%eax
jne    1120 <main+0x10>
fstp   %st(0)
flds   0xebf(%rip)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jne    114f <main+0x3f>
jp     114f <main+0x3f>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca x86_fp80
%3 = alloca i32
store i32 0, i32* %1
store x86_fp80 0xK00000000000000000000, x86_fp80* %2
store i32 0, i32* %3
br label %4
4: ; preds = %10, %0
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 1000
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = load x86_fp80, x86_fp80* %2
%9 = fadd x86_fp80 %8, 0xK3FFF8000000000000000
store x86_fp80 %9, x86_fp80* %2
br label %10
10: ; preds = %7
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
store i32 %12, i32* %3
br label %4
13: ; preds = %4
%14 = load x86_fp80, x86_fp80* %2
%15 = fcmp une x86_fp80 %14, 0xK4008FA00000000000000
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 (...) @abort()
unreachable
18: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 0, %0 ], [ %14, %1 ]
%3 = phi x86_fp80 [ 0xK00000000000000000000, %0 ], [ %13, %1 ]
%4 = fadd x86_fp80 %3, 0xK3FFF8000000000000000
%5 = fadd x86_fp80 %4, 0xK3FFF8000000000000000
%6 = fadd x86_fp80 %5, 0xK3FFF8000000000000000
%7 = fadd x86_fp80 %6, 0xK3FFF8000000000000000
%8 = fadd x86_fp80 %7, 0xK3FFF8000000000000000
%9 = fadd x86_fp80 %8, 0xK3FFF8000000000000000
%10 = fadd x86_fp80 %9, 0xK3FFF8000000000000000
%11 = fadd x86_fp80 %10, 0xK3FFF8000000000000000
%12 = fadd x86_fp80 %11, 0xK3FFF8000000000000000
%13 = fadd x86_fp80 %12, 0xK3FFF8000000000000000
%14 = add nuw nsw i32 %2, 10
%15 = icmp eq i32 %14, 1000
br i1 %15, label %16, label %1
16: ; preds = %1
%17 = fcmp une x86_fp80 %13, 0xK4008FA00000000000000
br i1 %17, label %18, label %20
18: ; preds = %16
%19 = tail call i32 (...) @abort()
unreachable
20: ; preds = %16
ret i32 0
}