#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*/ for2_(int *, float *, float *, double *);
int /*<<< orphan*/ printf(char *, ...);
void test02(void) {
  int int_val;
  float real_val;
  static float complex_val[2];
  double d_val;
  int_val = 13;
  real_val = 42.85;
  complex_val[0] = 123.45;
  complex_val[1] = 6.789;
  d_val = 12345.006789;
  printf("\n");
  printf("TEST02:\n");
  printf("  Pass numeric data to a FORTRAN routine, alter it, return it.\n");
  printf("\n");
  printf("  Integer value = %d\n", int_val);
  printf("  Real value = %f\n", real_val);
  printf("  Complex value = %f + %f*i\n", complex_val[0], complex_val[1]);
  printf("  Double value = %f\n", d_val);
  printf("\n");
  printf("TEST02\n");
  printf("  Call FOR2 to modify these values.\n");
  for2_(&int_val, &real_val, complex_val, &d_val);
  printf("\n");
  printf("TEST02:\n");
  printf("  New values of data as modified by FOR2:\n");
  printf("\n");
  printf("  Integer value = %d\n", int_val);
  printf("  Real value = %f\n", real_val);
  printf("  Complex value = %f + %f*i\n", complex_val[0], complex_val[1]);
  printf("  Double value = %f\n", d_val);
  return;
}


x86 assembly (clang, -O0):
<test02>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xd,-0x4(%rbp)
movss  0xed9(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xec8(%rip),%xmm0
movss  %xmm0,0x2ee8(%rip)
movss  0xeb4(%rip),%xmm0
movss  %xmm0,0x2edc(%rip)
movsd  0xe9c(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
lea    0xf73(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf49(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeb1(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x2e63(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x2e5b(%rip),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe9e(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  -0x10(%rbp),%xmm0
lea    0xea8(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
lea    0x2df9(%rip),%rdx
lea    -0x10(%rbp),%rcx
call   1030 <for2_@plt>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdbb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdd6(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x2d88(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x2d80(%rip),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xdc3(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  -0x10(%rbp),%xmm0
lea    0xdcd(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test02>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movl   $0xd,0xc(%rsp)
movl   $0x422b6666,0x8(%rsp)
42
movabs $0x40d93f7d42f6e666,%rax
3f d9 40
mov    %rax,0x2ed5(%rip)
lea    0x2ece(%rip),%r14
movabs $0x40c81c80de76427c,%rax
1c c8 40
mov    %rax,0x10(%rsp)
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xf3f(%rip),%r12
mov    %r12,%rdi
call   1050 <puts@plt>
lea    0xec6(%rip),%rdi
call   1050 <puts@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xe55(%rip),%r15
mov    %r15,%rdi
mov    $0xd,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe55(%rip),%r13
movsd  0xe27(%rip),%xmm0
mov    %r13,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0x2e59(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x2e51(%rip),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe37(%rip),%rbx
mov    %rbx,%rdi
mov    $0x2,%al
call   1060 <printf@plt>
lea    0xe43(%rip),%rbp
movsd  0xded(%rip),%xmm0
mov    %rbp,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xe74(%rip),%rdi
call   1050 <puts@plt>
lea    0xe6f(%rip),%rdi
call   1050 <puts@plt>
lea    0xc(%rsp),%rdi
lea    0x8(%rsp),%rsi
lea    0x10(%rsp),%rcx
mov    %r14,%rdx
call   1030 <for2_@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %r12,%rdi
call   1050 <puts@plt>
lea    0xe66(%rip),%rdi
call   1050 <puts@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    0xc(%rsp),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r13,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0x2d94(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x2d8c(%rip),%xmm1
cvtss2sd %xmm1,%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1060 <printf@plt>
movsd  0x10(%rsp),%xmm0
mov    %rbp,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@test02.complex_val = internal global [2 x float] zeroinitializer
@.str = [2 x i8] c"\0A\00"
@.str.1 = [9 x i8] c"TEST02:\0A\00"
@.str.2 = [64 x i8] c" Pass numeric data to a FORTRAN routine, alter it, return it.\0A\00"
@.str.3 = [22 x i8] c" Integer value = %d\0A\00"
@.str.4 = [19 x i8] c" Real value = %f\0A\00"
@.str.5 = [29 x i8] c" Complex value = %f + %f*i\0A\00"
@.str.6 = [21 x i8] c" Double value = %f\0A\00"
@.str.7 = [8 x i8] c"TEST02\0A\00"
@.str.8 = [37 x i8] c" Call FOR2 to modify these values.\0A\00"
@.str.9 = [43 x i8] c" New values of data as modified by FOR2:\0A\00"
define void @test02() {
%1 = alloca i32
%2 = alloca float
%3 = alloca double
store i32 13, i32* %1
store float 0x40456CCCC0000000, float* %2
store float 0x405EDCCCC0000000, float* getelementptr inbounds ([2 x float], [2 x float]* @test02.complex_val, i64 0, i64 0)
store float 0x401B27EFA0000000, float* getelementptr inbounds ([2 x float], [2 x float]* @test02.complex_val, i64 0, i64 1)
store double 0x40C81C80DE76427C, double* %3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %8)
%10 = load float, float* %2
%11 = fpext float %10 to double
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), double %11)
%13 = load float, float* getelementptr inbounds ([2 x float], [2 x float]* @test02.complex_val, i64 0, i64 0)
%14 = fpext float %13 to double
%15 = load float, float* getelementptr inbounds ([2 x float], [2 x float]* @test02.complex_val, i64 0, i64 1)
%16 = fpext float %15 to double
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), double %14, double %16)
%18 = load double, double* %3
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), double %18)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.8, i64 0, i64 0))
%23 = call i32 @for2_(i32* %1, float* %2, float* getelementptr inbounds ([2 x float], [2 x float]* @test02.complex_val, i64 0, i64 0), double* %3)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.9, i64 0, i64 0))
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%28 = load i32, i32* %1
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %28)
%30 = load float, float* %2
%31 = fpext float %30 to double
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), double %31)
%33 = load float, float* getelementptr inbounds ([2 x float], [2 x float]* @test02.complex_val, i64 0, i64 0)
%34 = fpext float %33 to double
%35 = load float, float* getelementptr inbounds ([2 x float], [2 x float]* @test02.complex_val, i64 0, i64 1)
%36 = fpext float %35 to double
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), double %34, double %36)
%38 = load double, double* %3
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), double %38)
ret void
}

LLVM IR (-O2):
@test02.complex_val = internal global [2 x float] zeroinitializer
@.str.3 = [22 x i8] c" Integer value = %d\0A\00"
@.str.4 = [19 x i8] c" Real value = %f\0A\00"
@.str.5 = [29 x i8] c" Complex value = %f + %f*i\0A\00"
@.str.6 = [21 x i8] c" Double value = %f\0A\00"
@str.10 = [63 x i8] c" Pass numeric data to a FORTRAN routine, alter it, return it.\00"
@str.11 = [7 x i8] c"TEST02\00"
@str.12 = [36 x i8] c" Call FOR2 to modify these values.\00"
@str.13 = [8 x i8] c"TEST02:\00"
@str.14 = [42 x i8] c" New values of data as modified by FOR2:\00"
define void @test02() {
%1 = alloca i32
%2 = alloca float
%3 = alloca double
%4 = bitcast i32* %1 to i8*
%5 = bitcast float* %2 to i8*
%6 = bitcast double* %3 to i8*
store i32 13, i32* %1
store float 0x40456CCCC0000000, float* %2
store float 0x405EDCCCC0000000, float* getelementptr inbounds ([2 x float], [2 x float]* @test02.complex_val, i64 0, i64 0)
store float 0x401B27EFA0000000, float* getelementptr inbounds ([2 x float], [2 x float]* @test02.complex_val, i64 0, i64 1)
store double 0x40C81C80DE76427C, double* %3
%7 = tail call i32 @putchar(i32 10)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.13, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @str.10, i64 0, i64 0))
%10 = tail call i32 @putchar(i32 10)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 13)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), double 0x40456CCCC0000000)
%13 = load float, float* getelementptr inbounds ([2 x float], [2 x float]* @test02.complex_val, i64 0, i64 0)
%14 = fpext float %13 to double
%15 = load float, float* getelementptr inbounds ([2 x float], [2 x float]* @test02.complex_val, i64 0, i64 1)
%16 = fpext float %15 to double
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), double %14, double %16)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), double 0x40C81C80DE76427C)
%19 = tail call i32 @putchar(i32 10)
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.11, i64 0, i64 0))
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.12, i64 0, i64 0))
%22 = call i32 @for2_(i32* %1, float* %2, float* getelementptr inbounds ([2 x float], [2 x float]* @test02.complex_val, i64 0, i64 0), double* %3)
%23 = call i32 @putchar(i32 10)
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.13, i64 0, i64 0))
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.14, i64 0, i64 0))
%26 = call i32 @putchar(i32 10)
%27 = load i32, i32* %1
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %27)
%29 = load float, float* %2
%30 = fpext float %29 to double
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), double %30)
%32 = load float, float* getelementptr inbounds ([2 x float], [2 x float]* @test02.complex_val, i64 0, i64 0)
%33 = fpext float %32 to double
%34 = load float, float* getelementptr inbounds ([2 x float], [2 x float]* @test02.complex_val, i64 0, i64 1)
%35 = fpext float %34 to double
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), double %33, double %35)
%37 = load double, double* %3
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), double %37)
ret void
}