#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 _ada_use_c2phc(int, int *, int *, double *);
int read_standard_target_system_from_file(int n, char *filename) {
  int b[n], i, fail;
  double *c;
  for (i = 0; i < n; i++)
    b[i] = (int)filename[i];
  fail = _ada_use_c2phc(540, &n, b, c);
  return fail;
}


x86 assembly (clang, -O0):
<read_standard_target_system_from_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    117e <read_standard_target_system_from_file+0x6e>
mov    -0x38(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq -0x24(%rbp),%rdx
movsbl (%rcx,%rdx,1),%edx
movslq -0x24(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    114d <read_standard_target_system_from_file+0x3d>
mov    -0x38(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    $0x21c,%edi
lea    -0x4(%rbp),%rsi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_standard_target_system_from_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %edi,%r9d
mov    %rsp,%rdx
lea    0xf(,%r9,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rdx
mov    %rdx,%rsp
test   %edi,%edi
jle    1230 <read_standard_target_system_from_file+0x120>
cmp    $0x8,%edi
jae    1147 <read_standard_target_system_from_file+0x37>
xor    %ecx,%ecx
jmp    1220 <read_standard_target_system_from_file+0x110>
mov    %r9d,%ecx
and    $0xfffffff8,%ecx
lea    -0x8(%rcx),%rax
mov    %rax,%r8
shr    $0x3,%r8
add    $0x1,%r8
test   %rax,%rax
je     1243 <read_standard_target_system_from_file+0x133>
mov    %r8,%rax
and    $0xfffffffffffffffe,%rax
xor    %edi,%edi
xchg   %ax,%ax
movd   (%rsi,%rdi,1),%xmm0
punpcklbw %xmm0,%xmm0
punpcklwd %xmm0,%xmm0
movd   0x4(%rsi,%rdi,1),%xmm1
punpcklbw %xmm1,%xmm1
punpcklwd %xmm1,%xmm1
psrad  $0x18,%xmm0
psrad  $0x18,%xmm1
movdqa %xmm0,(%rdx,%rdi,4)
movdqa %xmm1,0x10(%rdx,%rdi,4)
movd   0x8(%rsi,%rdi,1),%xmm0
punpcklbw %xmm0,%xmm0
punpcklwd %xmm0,%xmm0
movd   0xc(%rsi,%rdi,1),%xmm1
punpcklbw %xmm1,%xmm1
punpcklwd %xmm1,%xmm1
psrad  $0x18,%xmm0
psrad  $0x18,%xmm1
movdqa %xmm0,0x20(%rdx,%rdi,4)
movdqa %xmm1,0x30(%rdx,%rdi,4)
add    $0x10,%rdi
add    $0xfffffffffffffffe,%rax
jne    1170 <read_standard_target_system_from_file+0x60>
test   $0x1,%r8b
je     1212 <read_standard_target_system_from_file+0x102>
movd   (%rsi,%rdi,1),%xmm0
movd   0x4(%rsi,%rdi,1),%xmm1
punpcklbw %xmm0,%xmm0
punpcklwd %xmm0,%xmm0
psrad  $0x18,%xmm0
punpcklbw %xmm1,%xmm1
punpcklwd %xmm1,%xmm1
psrad  $0x18,%xmm1
movdqa %xmm0,(%rdx,%rdi,4)
movdqa %xmm1,0x10(%rdx,%rdi,4)
cmp    %r9,%rcx
je     1230 <read_standard_target_system_from_file+0x120>
nopw   0x0(%rax,%rax,1)
movsbl (%rsi,%rcx,1),%eax
mov    %eax,(%rdx,%rcx,4)
add    $0x1,%rcx
cmp    %rcx,%r9
jne    1220 <read_standard_target_system_from_file+0x110>
lea    -0x4(%rbp),%rsi
mov    $0x21c,%edi
call   1030 <_ada_use_c2phc@plt>
mov    %rbp,%rsp
pop    %rbp
ret
xor    %edi,%edi
test   $0x1,%r8b
jne    11e2 <read_standard_target_system_from_file+0xd2>
jmp    1212 <read_standard_target_system_from_file+0x102>

LLVM IR (-O0):
define i32 @read_standard_target_system_from_file(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
%9 = alloca double*
store i32 %0, i32* %3
store i8* %1, i8** %4
%10 = load i32, i32* %3
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %5
%13 = alloca i32, i64 %11
store i64 %11, i64* %6
store i32 0, i32* %7
br label %14
14: ; preds = %28, %2
%15 = load i32, i32* %7
%16 = load i32, i32* %3
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %31
18: ; preds = %14
%19 = load i8*, i8** %4
%20 = load i32, i32* %7
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = load i32, i32* %7
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %13, i64 %26
store i32 %24, i32* %27
br label %28
28: ; preds = %18
%29 = load i32, i32* %7
%30 = add nsw i32 %29, 1
store i32 %30, i32* %7
br label %14
31: ; preds = %14
%32 = load double*, double** %9
%33 = call i32 @_ada_use_c2phc(i32 540, i32* %3, i32* %13, double* %32)
store i32 %33, i32* %8
%34 = load i32, i32* %8
%35 = load i8*, i8** %5
ret i32 %34
}

LLVM IR (-O2):
define i32 @read_standard_target_system_from_file(i32 %0, i8* nocapture %1) {
%3 = alloca i32
store i32 %0, i32* %3
%4 = zext i32 %0 to i64
%5 = alloca i32, i64 %4
%6 = icmp sgt i32 %0, 0
br i1 %6, label %7, label %77
7: ; preds = %2
%8 = icmp ult i32 %0, 8
br i1 %8, label %67, label %9
9: ; preds = %7
%10 = and i64 %4, 4294967288
%11 = add nsw i64 %10, -8
%12 = lshr exact i64 %11, 3
%13 = add nuw nsw i64 %12, 1
%14 = and i64 %13, 1
%15 = icmp eq i64 %11, 0
br i1 %15, label %49, label %16
16: ; preds = %9
%17 = and i64 %13, 4611686018427387902
br label %18
18: ; preds = %18, %16
%19 = phi i64 [ 0, %16 ], [ %46, %18 ]
%20 = phi i64 [ 0, %16 ], [ %47, %18 ]
%21 = getelementptr inbounds i8, i8* %1, i64 %19
%22 = bitcast i8* %21 to <4 x i8>*
%23 = load <4 x i8>, <4 x i8>* %22
%24 = getelementptr inbounds i8, i8* %21, i64 4
%25 = bitcast i8* %24 to <4 x i8>*
%26 = load <4 x i8>, <4 x i8>* %25
%27 = sext <4 x i8> %23 to <4 x i32>
%28 = sext <4 x i8> %26 to <4 x i32>
%29 = getelementptr inbounds i32, i32* %5, i64 %19
%30 = bitcast i32* %29 to <4 x i32>*
store <4 x i32> %27, <4 x i32>* %30
%31 = getelementptr inbounds i32, i32* %29, i64 4
%32 = bitcast i32* %31 to <4 x i32>*
store <4 x i32> %28, <4 x i32>* %32
%33 = or i64 %19, 8
%34 = getelementptr inbounds i8, i8* %1, i64 %33
%35 = bitcast i8* %34 to <4 x i8>*
%36 = load <4 x i8>, <4 x i8>* %35
%37 = getelementptr inbounds i8, i8* %34, i64 4
%38 = bitcast i8* %37 to <4 x i8>*
%39 = load <4 x i8>, <4 x i8>* %38
%40 = sext <4 x i8> %36 to <4 x i32>
%41 = sext <4 x i8> %39 to <4 x i32>
%42 = getelementptr inbounds i32, i32* %5, i64 %33
%43 = bitcast i32* %42 to <4 x i32>*
store <4 x i32> %40, <4 x i32>* %43
%44 = getelementptr inbounds i32, i32* %42, i64 4
%45 = bitcast i32* %44 to <4 x i32>*
store <4 x i32> %41, <4 x i32>* %45
%46 = add nuw i64 %19, 16
%47 = add i64 %20, 2
%48 = icmp eq i64 %47, %17
br i1 %48, label %49, label %18
49: ; preds = %18, %9
%50 = phi i64 [ 0, %9 ], [ %46, %18 ]
%51 = icmp eq i64 %14, 0
br i1 %51, label %65, label %52
52: ; preds = %49
%53 = getelementptr inbounds i8, i8* %1, i64 %50
%54 = bitcast i8* %53 to <4 x i8>*
%55 = load <4 x i8>, <4 x i8>* %54
%56 = getelementptr inbounds i8, i8* %53, i64 4
%57 = bitcast i8* %56 to <4 x i8>*
%58 = load <4 x i8>, <4 x i8>* %57
%59 = sext <4 x i8> %55 to <4 x i32>
%60 = sext <4 x i8> %58 to <4 x i32>
%61 = getelementptr inbounds i32, i32* %5, i64 %50
%62 = bitcast i32* %61 to <4 x i32>*
store <4 x i32> %59, <4 x i32>* %62
%63 = getelementptr inbounds i32, i32* %61, i64 4
%64 = bitcast i32* %63 to <4 x i32>*
store <4 x i32> %60, <4 x i32>* %64
br label %65
65: ; preds = %49, %52
%66 = icmp eq i64 %10, %4
br i1 %66, label %77, label %67
67: ; preds = %7, %65
%68 = phi i64 [ 0, %7 ], [ %10, %65 ]
br label %69
69: ; preds = %67, %69
%70 = phi i64 [ %75, %69 ], [ %68, %67 ]
%71 = getelementptr inbounds i8, i8* %1, i64 %70
%72 = load i8, i8* %71
%73 = sext i8 %72 to i32
%74 = getelementptr inbounds i32, i32* %5, i64 %70
store i32 %73, i32* %74
%75 = add nuw nsw i64 %70, 1
%76 = icmp eq i64 %75, %4
br i1 %76, label %77, label %69
77: ; preds = %69, %65, %2
%78 = call i32 @_ada_use_c2phc(i32 540, i32* %3, i32* %5, double* undef)
ret i32 %78
}