#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 fabs(double);
int tag_quasi(int tagarray[], double quasi[], double unperturbed_quasi[],
              int size) {
  int i, j, err = 1;
  double quasienergy, unperturbed_quasienergy, diff;
  for (i = 0; i < size; i++) {
    quasienergy = quasi[i];
    for (j = 0; j < size; j++) {
      unperturbed_quasienergy = unperturbed_quasi[j];
      diff = quasienergy - unperturbed_quasienergy;
      if (fabs(diff) <= 1E-5)
        tagarray[i] = j;
    }
  }
  return (err);
}


x86 assembly (clang, -O0):
<tag_quasi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x1,-0x28(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11db <tag_quasi+0xcb>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11c8 <tag_quasi+0xb8>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xe63(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     11b5 <tag_quasi+0xa5>
mov    -0x24(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
jmp    11ba <tag_quasi+0xaa>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    115a <tag_quasi+0x4a>
jmp    11cd <tag_quasi+0xbd>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1135 <tag_quasi+0x25>
mov    -0x28(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tag_quasi>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,0x10(%rsp)
mov    %ecx,0x4(%rsp)
test   %ecx,%ecx
jle    11e4 <tag_quasi+0xd4>
mov    %rdx,%rbx
mov    %rdi,%r13
mov    0x4(%rsp),%r12d
mov    %r12d,%ebp
and    $0xfffffffe,%ebp
xor    %r14d,%r14d
jmp    115d <tag_quasi+0x4d>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%r14
cmp    %r12,%r14
je     11e4 <tag_quasi+0xd4>
mov    0x10(%rsp),%rax
movsd  (%rax,%r14,8),%xmm0
cmpl   $0x1,0x4(%rsp)
jne    1190 <tag_quasi+0x80>
xor    %r15d,%r15d
test   $0x1,%r12b
je     1150 <tag_quasi+0x40>
subsd  (%rbx,%r15,8),%xmm0
call   1030 <fabs@plt>
test   %eax,%eax
jg     1150 <tag_quasi+0x40>
mov    %r15d,0x0(%r13,%r14,4)
jmp    1150 <tag_quasi+0x40>
xchg   %ax,%ax
xor    %r15d,%r15d
movsd  %xmm0,0x8(%rsp)
jmp    11af <tag_quasi+0x9f>
nopl   0x0(%rax,%rax,1)
add    $0x2,%r15
cmp    %r15,%rbp
movsd  0x8(%rsp),%xmm0
je     1172 <tag_quasi+0x62>
subsd  (%rbx,%r15,8),%xmm0
call   1030 <fabs@plt>
test   %eax,%eax
jg     11c3 <tag_quasi+0xb3>
mov    %r15d,0x0(%r13,%r14,4)
movsd  0x8(%rsp),%xmm0
subsd  0x8(%rbx,%r15,8),%xmm0
call   1030 <fabs@plt>
test   %eax,%eax
jg     11a0 <tag_quasi+0x90>
lea    0x1(%r15),%eax
mov    %eax,0x0(%r13,%r14,4)
jmp    11a0 <tag_quasi+0x90>
mov    $0x1,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @tag_quasi(i32* %0, double* %1, double* %2, i32 %3) {
%5 = alloca i32*
%6 = alloca double*
%7 = alloca double*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca double
%13 = alloca double
%14 = alloca double
store i32* %0, i32** %5
store double* %1, double** %6
store double* %2, double** %7
store i32 %3, i32* %8
store i32 1, i32* %11
store i32 0, i32* %9
br label %15
15: ; preds = %53, %4
%16 = load i32, i32* %9
%17 = load i32, i32* %8
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %56
19: ; preds = %15
%20 = load double*, double** %6
%21 = load i32, i32* %9
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds double, double* %20, i64 %22
%24 = load double, double* %23
store double %24, double* %12
store i32 0, i32* %10
br label %25
25: ; preds = %49, %19
%26 = load i32, i32* %10
%27 = load i32, i32* %8
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %52
29: ; preds = %25
%30 = load double*, double** %7
%31 = load i32, i32* %10
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds double, double* %30, i64 %32
%34 = load double, double* %33
store double %34, double* %13
%35 = load double, double* %12
%36 = load double, double* %13
%37 = fsub double %35, %36
store double %37, double* %14
%38 = load double, double* %14
%39 = call i32 @fabs(double %38)
%40 = sitofp i32 %39 to double
%41 = fcmp ole double %40, 1.000000e-05
br i1 %41, label %42, label %48
42: ; preds = %29
%43 = load i32, i32* %10
%44 = load i32*, i32** %5
%45 = load i32, i32* %9
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i32, i32* %44, i64 %46
store i32 %43, i32* %47
br label %48
48: ; preds = %42, %29
br label %49
49: ; preds = %48
%50 = load i32, i32* %10
%51 = add nsw i32 %50, 1
store i32 %51, i32* %10
br label %25
52: ; preds = %25
br label %53
53: ; preds = %52
%54 = load i32, i32* %9
%55 = add nsw i32 %54, 1
store i32 %55, i32* %9
br label %15
56: ; preds = %15
%57 = load i32, i32* %11
ret i32 %57
}

LLVM IR (-O2):
define i32 @tag_quasi(i32* nocapture writeonly %0, double* nocapture %1, double* nocapture %2, i32 %3) {
%5 = icmp sgt i32 %3, 0
br i1 %5, label %6, label %53
6: ; preds = %4
%7 = zext i32 %3 to i64
%8 = and i64 %7, 1
%9 = icmp eq i32 %3, 1
%10 = and i64 %7, 4294967294
%11 = icmp eq i64 %8, 0
br label %12
12: ; preds = %50, %6
%13 = phi i64 [ 0, %6 ], [ %51, %50 ]
%14 = getelementptr inbounds double, double* %1, i64 %13
%15 = load double, double* %14
%16 = getelementptr inbounds i32, i32* %0, i64 %13
br i1 %9, label %40, label %17
17: ; preds = %12, %36
%18 = phi i64 [ %37, %36 ], [ 0, %12 ]
%19 = phi i64 [ %38, %36 ], [ 0, %12 ]
%20 = getelementptr inbounds double, double* %2, i64 %18
%21 = load double, double* %20
%22 = fsub double %15, %21
%23 = tail call i32 @fabs(double %22)
%24 = icmp slt i32 %23, 1
br i1 %24, label %25, label %27
25: ; preds = %17
%26 = trunc i64 %18 to i32
store i32 %26, i32* %16
br label %27
27: ; preds = %17, %25
%28 = or i64 %18, 1
%29 = getelementptr inbounds double, double* %2, i64 %28
%30 = load double, double* %29
%31 = fsub double %15, %30
%32 = tail call i32 @fabs(double %31)
%33 = icmp slt i32 %32, 1
br i1 %33, label %34, label %36
34: ; preds = %27
%35 = trunc i64 %28 to i32
store i32 %35, i32* %16
br label %36
36: ; preds = %34, %27
%37 = add nuw nsw i64 %18, 2
%38 = add i64 %19, 2
%39 = icmp eq i64 %38, %10
br i1 %39, label %40, label %17
40: ; preds = %36, %12
%41 = phi i64 [ 0, %12 ], [ %37, %36 ]
br i1 %11, label %50, label %42
42: ; preds = %40
%43 = getelementptr inbounds double, double* %2, i64 %41
%44 = load double, double* %43
%45 = fsub double %15, %44
%46 = tail call i32 @fabs(double %45)
%47 = icmp slt i32 %46, 1
br i1 %47, label %48, label %50
48: ; preds = %42
%49 = trunc i64 %41 to i32
store i32 %49, i32* %16
br label %50
50: ; preds = %42, %48, %40
%51 = add nuw nsw i64 %13, 1
%52 = icmp eq i64 %51, %7
br i1 %52, label %53, label %12
53: ; preds = %50, %4
ret i32 1
}