#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*/ printf(char *);
int /*<<< orphan*/ test01();
int /*<<< orphan*/ test02();
int /*<<< orphan*/ test03();
int /*<<< orphan*/ test04();
int main(void) {
  printf("\n");
  printf("MAIN:\n");
  printf("  An example of a C/FORTRAN interface.\n");
  printf("  The main program is written in C.\n");
  printf("  It calls FORTRAN routines, which in turn call C routines.\n");
  printf("\n");
  test01();
  test02();
  test03();
  test04();
  printf("\n");
  printf("MAIN:\n");
  printf("  Normal end of execution.\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xef7(%rip),%rdi
call   1050 <printf@plt>
lea    0xe99(%rip),%rdi
call   1050 <printf@plt>
lea    0xe94(%rip),%rdi
call   1050 <printf@plt>
lea    0xeb0(%rip),%rdi
call   1050 <printf@plt>
lea    0xec9(%rip),%rdi
call   1050 <printf@plt>
lea    0xebb(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <test01@plt>
mov    $0x0,%al
call   1060 <test02@plt>
mov    $0x0,%al
call   1040 <test03@plt>
mov    $0x0,%al
call   1070 <test04@plt>
lea    0xe93(%rip),%rdi
call   1050 <printf@plt>
lea    0xe35(%rip),%rdi
call   1050 <printf@plt>
lea    0xeba(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xf15(%rip),%rbx
mov    %rbx,%rdi
call   1050 <puts@plt>
lea    0xe7f(%rip),%rdi
call   1050 <puts@plt>
lea    0xe9a(%rip),%rdi
call   1050 <puts@plt>
lea    0xeb2(%rip),%rdi
call   1050 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <test01@plt>
xor    %eax,%eax
call   1070 <test02@plt>
xor    %eax,%eax
call   1060 <test03@plt>
xor    %eax,%eax
call   1080 <test04@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1050 <puts@plt>
lea    0xeb0(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [7 x i8] c"MAIN:\0A\00"
@.str.2 = [40 x i8] c" An example of a C/FORTRAN interface.\0A\00"
@.str.3 = [37 x i8] c" The main program is written in C.\0A\00"
@.str.4 = [61 x i8] c" It calls FORTRAN routines, which in turn call C routines.\0A\00"
@.str.5 = [28 x i8] c" Normal end of execution.\0A\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.4, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (...) @test01()
%8 = call i32 (...) @test02()
%9 = call i32 (...) @test03()
%10 = call i32 (...) @test04()
%11 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str.6 = [39 x i8] c" An example of a C/FORTRAN interface.\00"
@str.7 = [36 x i8] c" The main program is written in C.\00"
@str.8 = [60 x i8] c" It calls FORTRAN routines, which in turn call C routines.\00"
@str.9 = [6 x i8] c"MAIN:\00"
@str.10 = [27 x i8] c" Normal end of execution.\00"
define i32 @main() {
%1 = tail call i32 @putchar(i32 10)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.9, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.6, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.7, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str.8, i64 0, i64 0))
%6 = tail call i32 @putchar(i32 10)
%7 = tail call i32 (...) @test01()
%8 = tail call i32 (...) @test02()
%9 = tail call i32 (...) @test03()
%10 = tail call i32 (...) @test04()
%11 = tail call i32 @putchar(i32 10)
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.9, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.10, i64 0, i64 0))
ret i32 0
}