#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int /*<<< orphan*/ exit(int);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int fread(float *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int getrecord(double field[256], FILE *fp) {
  char buf[16 * 256];
  int nf;
  float *fbuf = (float *)buf;
  int i;
  int c;
  c = fgetc(fp);
  if (EOF == c || '~' == c) {
    fgetc(fp);
    return 0;
  } else if ('\t' != c) {
    fprintf(stderr, "Unexpected character: %c\n", c);
    exit(-1);
  }
  nf = fread(fbuf, sizeof(float), 3, fp);
  for (i = nf; i-- > 0;)
    field[i] = fbuf[i];
  return (nf);
}


x86 assembly (clang, -O0):
<getrecord>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1040,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    -0x1020(%rbp),%rax
mov    %rax,-0x1030(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %eax,-0x1038(%rbp)
mov    0x2e71(%rip),%rax
mov    (%rax),%eax
cmp    -0x1038(%rbp),%eax
je     1196 <getrecord+0x56>
mov    $0x7e,%eax
cmp    -0x1038(%rbp),%eax
jne    11ab <getrecord+0x6b>
mov    -0x18(%rbp),%rdi
call   1040 <fgetc@plt>
movl   $0x0,-0x4(%rbp)
jmp    1261 <getrecord+0x121>
mov    $0x9,%eax
cmp    -0x1038(%rbp),%eax
je     11e1 <getrecord+0xa1>
mov    0x2e15(%rip),%rax
mov    (%rax),%edi
mov    -0x1038(%rbp),%edx
lea    0xe2e(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
jmp    11e6 <getrecord+0xa6>
mov    -0x1030(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x4,%esi
mov    $0x3,%edx
call   1030 <fread@plt>
mov    %eax,-0x1024(%rbp)
mov    -0x1024(%rbp),%eax
mov    %eax,-0x1034(%rbp)
mov    -0x1034(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x1034(%rbp)
cmp    $0x0,%eax
jle    1258 <getrecord+0x118>
mov    -0x1030(%rbp),%rax
movslq -0x1034(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x1034(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    1212 <getrecord+0xd2>
mov    -0x1024(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1040,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getrecord>:
push   %r14
push   %rbx
sub    $0x1008,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1040 <fgetc@plt>
cmp    $0x7e,%eax
je     120f <getrecord+0xcf>
mov    0x2e80(%rip),%rcx
cmp    %eax,(%rcx)
je     120f <getrecord+0xcf>
cmp    $0x9,%eax
jne    1256 <getrecord+0x116>
mov    %rsp,%rdi
mov    $0x4,%esi
mov    $0x3,%edx
mov    %r14,%rcx
call   1030 <fread@plt>
test   %eax,%eax
jle    124b <getrecord+0x10b>
mov    %eax,%r9d
cmp    $0x4,%eax
jb     121b <getrecord+0xdb>
lea    -0x1(%r9),%rsi
mov    %eax,%ecx
add    $0xffffffff,%ecx
cmp    %esi,%ecx
jb     121b <getrecord+0xdb>
mov    %rsi,%rcx
shr    $0x20,%rcx
jne    121b <getrecord+0xdb>
mov    %r9d,%r8d
and    $0xfffffffc,%r8d
mov    %r9d,%ecx
and    $0x3,%ecx
mov    %r8,%rdi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %esi,%edx
movsd  -0xc(%rsp,%rdx,4),%xmm0
movsd  -0x4(%rsp,%rdx,4),%xmm1
shufps $0xe1,%xmm1,%xmm1
shufps $0xe1,%xmm0,%xmm0
cvtps2pd %xmm1,%xmm1
cvtps2pd %xmm0,%xmm0
shufps $0x4e,%xmm1,%xmm1
movups %xmm1,-0x8(%rbx,%rdx,8)
shufps $0x4e,%xmm0,%xmm0
movups %xmm0,-0x18(%rbx,%rdx,8)
add    $0xfffffffffffffffc,%rsi
add    $0xfffffffffffffffc,%rdi
jne    11d0 <getrecord+0x90>
cmp    %r9,%r8
jne    121e <getrecord+0xde>
jmp    124b <getrecord+0x10b>
mov    %r14,%rdi
call   1040 <fgetc@plt>
xor    %eax,%eax
jmp    124b <getrecord+0x10b>
mov    %r9,%rcx
add    $0x1,%rcx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    -0x2(%rcx),%edx
movss  (%rsp,%rdx,4),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,(%rbx,%rdx,8)
add    $0xffffffffffffffff,%rcx
cmp    $0x1,%rcx
ja     1230 <getrecord+0xf0>
add    $0x1008,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2d7b(%rip),%rcx
mov    (%rcx),%edi
lea    0xd9a(%rip),%rsi
mov    %eax,%edx
call   1050 <fprintf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@EOF = global i32 0
@stderr = global i32 0
@.str = [26 x i8] c"Unexpected character: %c\0A\00"
define i32 @getrecord(double* %0, i32* %1) {
%3 = alloca i32
%4 = alloca double*
%5 = alloca i32*
%6 = alloca [4096 x i8]
%7 = alloca i32
%8 = alloca float*
%9 = alloca i32
%10 = alloca i32
store double* %0, double** %4
store i32* %1, i32** %5
%11 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%12 = bitcast i8* %11 to float*
store float* %12, float** %8
%13 = load i32*, i32** %5
%14 = call i32 @fgetc(i32* %13)
store i32 %14, i32* %10
%15 = load i32, i32* @EOF
%16 = load i32, i32* %10
%17 = icmp eq i32 %15, %16
br i1 %17, label %21, label %18
18: ; preds = %2
%19 = load i32, i32* %10
%20 = icmp eq i32 126, %19
br i1 %20, label %21, label %24
21: ; preds = %18, %2
%22 = load i32*, i32** %5
%23 = call i32 @fgetc(i32* %22)
store i32 0, i32* %3
br label %55
24: ; preds = %18
%25 = load i32, i32* %10
%26 = icmp ne i32 9, %25
br i1 %26, label %27, label %32
27: ; preds = %24
%28 = load i32, i32* @stderr
%29 = load i32, i32* %10
%30 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %29)
%31 = call i32 @exit(i32 -1)
unreachable
32: ; preds = %24
br label %33
33: ; preds = %32
%34 = load float*, float** %8
%35 = load i32*, i32** %5
%36 = call i32 @fread(float* %34, i32 4, i32 3, i32* %35)
store i32 %36, i32* %7
%37 = load i32, i32* %7
store i32 %37, i32* %9
br label %38
38: ; preds = %42, %33
%39 = load i32, i32* %9
%40 = add nsw i32 %39, -1
store i32 %40, i32* %9
%41 = icmp sgt i32 %39, 0
br i1 %41, label %42, label %53
42: ; preds = %38
%43 = load float*, float** %8
%44 = load i32, i32* %9
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds float, float* %43, i64 %45
%47 = load float, float* %46
%48 = fpext float %47 to double
%49 = load double*, double** %4
%50 = load i32, i32* %9
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds double, double* %49, i64 %51
store double %48, double* %52
br label %38
53: ; preds = %38
%54 = load i32, i32* %7
store i32 %54, i32* %3
br label %55
55: ; preds = %53, %21
%56 = load i32, i32* %3
ret i32 %56
}

LLVM IR (-O2):
@EOF = global i32 0
@stderr = global i32 0
@.str = [26 x i8] c"Unexpected character: %c\0A\00"
define i32 @getrecord(double* nocapture writeonly %0, i32* nocapture %1) {
%3 = alloca [4096 x i8]
%4 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%5 = bitcast [4096 x i8]* %3 to float*
%6 = tail call i32 @fgetc(i32* %1)
%7 = load i32, i32* @EOF
%8 = icmp eq i32 %7, %6
%9 = icmp eq i32 %6, 126
%10 = or i1 %9, %8
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = tail call i32 @fgetc(i32* %1)
br label %75
13: ; preds = %2
%14 = icmp eq i32 %6, 9
br i1 %14, label %19, label %15
15: ; preds = %13
%16 = load i32, i32* @stderr
%17 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %6)
%18 = tail call i32 @exit(i32 -1)
unreachable
19: ; preds = %13
%20 = call i32 @fread(float* %5, i32 4, i32 3, i32* %1)
%21 = icmp sgt i32 %20, 0
br i1 %21, label %22, label %75
22: ; preds = %19
%23 = zext i32 %20 to i64
%24 = icmp ult i32 %20, 4
br i1 %24, label %64, label %25
25: ; preds = %22
%26 = add nsw i64 %23, -1
%27 = add i32 %20, -1
%28 = trunc i64 %26 to i32
%29 = icmp ult i32 %27, %28
%30 = icmp ugt i64 %26, 4294967295
%31 = or i1 %29, %30
br i1 %31, label %64, label %32
32: ; preds = %25
%33 = and i64 %23, 4294967292
%34 = and i64 %23, 3
br label %35
35: ; preds = %35, %32
%36 = phi i64 [ 0, %32 ], [ %60, %35 ]
%37 = xor i64 %36, -1
%38 = add i64 %37, %23
%39 = and i64 %38, 4294967295
%40 = getelementptr inbounds float, float* %5, i64 %39
%41 = getelementptr inbounds float, float* %40, i64 -1
%42 = bitcast float* %41 to <2 x float>*
%43 = load <2 x float>, <2 x float>* %42
%44 = shufflevector <2 x float> %43, <2 x float> poison, <2 x i32> <i32 1, i32 0>
%45 = getelementptr inbounds float, float* %40, i64 -2
%46 = getelementptr inbounds float, float* %45, i64 -1
%47 = bitcast float* %46 to <2 x float>*
%48 = load <2 x float>, <2 x float>* %47
%49 = shufflevector <2 x float> %48, <2 x float> poison, <2 x i32> <i32 1, i32 0>
%50 = fpext <2 x float> %44 to <2 x double>
%51 = fpext <2 x float> %49 to <2 x double>
%52 = getelementptr inbounds double, double* %0, i64 %39
%53 = shufflevector <2 x double> %50, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%54 = getelementptr inbounds double, double* %52, i64 -1
%55 = bitcast double* %54 to <2 x double>*
store <2 x double> %53, <2 x double>* %55
%56 = shufflevector <2 x double> %51, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%57 = getelementptr inbounds double, double* %52, i64 -2
%58 = getelementptr inbounds double, double* %57, i64 -1
%59 = bitcast double* %58 to <2 x double>*
store <2 x double> %56, <2 x double>* %59
%60 = add nuw i64 %36, 4
%61 = icmp eq i64 %60, %33
br i1 %61, label %62, label %35
62: ; preds = %35
%63 = icmp eq i64 %33, %23
br i1 %63, label %75, label %64
64: ; preds = %25, %22, %62
%65 = phi i64 [ %23, %25 ], [ %23, %22 ], [ %34, %62 ]
br label %66
66: ; preds = %64, %66
%67 = phi i64 [ %68, %66 ], [ %65, %64 ]
%68 = add nsw i64 %67, -1
%69 = and i64 %68, 4294967295
%70 = getelementptr inbounds float, float* %5, i64 %69
%71 = load float, float* %70
%72 = fpext float %71 to double
%73 = getelementptr inbounds double, double* %0, i64 %69
store double %72, double* %73
%74 = icmp ugt i64 %67, 1
br i1 %74, label %66, label %75
75: ; preds = %66, %62, %19, %11
%76 = phi i32 [ 0, %11 ], [ %20, %19 ], [ %20, %62 ], [ %20, %66 ]
ret i32 %76
}