int main(int argc, char **argv) {
  int i;
  void *A, *A_ghost;
  void *M;
  double *xl;
  double *b;
  int nparts = 1;
  int init_type = 1;
  int nlf;
  xl = malloc(225 * sizeof(double));
  b = malloc(225 * sizeof(double));
  ext_doug_init_(&init_type);
  alloc_spmtx_(&A);
  alloc_spmtx_(&A_ghost);
  alloc_mesh_(&M);
  printf("Initialized, matrix %x, mesh %x\n", A, M);
  ext_paralleldistributeinput_(M, A, b, &nparts, A_ghost, &nlf);
  ext_cg_(A, b, M, xl, &nlf);
  ext_doug_finalize_();
  printf("result size=%d:\n", nlf);
  for (i = 0; i < nlf; i++) {
    printf("%f ", xl[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x44(%rbp)
movl   $0x1,-0x48(%rbp)
mov    $0x708,%edi
call   1070 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    $0x708,%edi
call   1070 <malloc@plt>
mov    %rax,-0x40(%rbp)
lea    -0x48(%rbp),%rdi
mov    $0x0,%al
call   1090 <ext_doug_init_@plt>
lea    -0x20(%rbp),%rdi
mov    $0x0,%al
call   1080 <alloc_spmtx_@plt>
lea    -0x28(%rbp),%rdi
mov    $0x0,%al
call   1080 <alloc_spmtx_@plt>
lea    -0x30(%rbp),%rdi
mov    $0x0,%al
call   10a0 <alloc_mesh_@plt>
mov    -0x20(%rbp),%rsi
mov    -0x30(%rbp),%rdx
lea    0xe05(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x40(%rbp),%rdx
mov    -0x28(%rbp),%r8
lea    -0x44(%rbp),%rcx
lea    -0x4c(%rbp),%r9
mov    $0x0,%al
call   1060 <ext_paralleldistributeinput_@plt>
mov    -0x20(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x38(%rbp),%rcx
lea    -0x4c(%rbp),%r8
mov    $0x0,%al
call   1040 <ext_cg_@plt>
mov    $0x0,%al
call   1030 <ext_doug_finalize_@plt>
mov    -0x4c(%rbp),%esi
lea    0xdd4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4c(%rbp),%eax
jge    1290 <main+0x110>
mov    -0x38(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xdb7(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    125b <main+0xdb>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
movl   $0x1,0x24(%rsp)
movl   $0x1,0x20(%rsp)
mov    $0x708,%edi
call   1070 <malloc@plt>
mov    %rax,%r15
mov    $0x708,%edi
call   1070 <malloc@plt>
mov    %rax,%r14
lea    0x20(%rsp),%rdi
xor    %eax,%eax
call   1090 <ext_doug_init_@plt>
lea    0x18(%rsp),%rdi
xor    %eax,%eax
call   1080 <alloc_spmtx_@plt>
lea    0x28(%rsp),%rdi
xor    %eax,%eax
call   1080 <alloc_spmtx_@plt>
lea    0x10(%rsp),%rdi
xor    %eax,%eax
call   10a0 <alloc_mesh_@plt>
mov    0x18(%rsp),%rsi
mov    0x10(%rsp),%rdx
lea    0xe0c(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%rdi
mov    0x18(%rsp),%rsi
mov    0x28(%rsp),%r8
lea    0x24(%rsp),%rcx
lea    0xc(%rsp),%rbx
mov    %r14,%rdx
mov    %rbx,%r9
xor    %eax,%eax
call   1060 <ext_paralleldistributeinput_@plt>
mov    0x18(%rsp),%rdi
mov    0x10(%rsp),%rdx
mov    %r14,%rsi
mov    %r15,%rcx
mov    %rbx,%r8
xor    %eax,%eax
call   1040 <ext_cg_@plt>
xor    %eax,%eax
call   1030 <ext_doug_finalize_@plt>
mov    0xc(%rsp),%esi
lea    0xdd4(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmpl   $0x0,0xc(%rsp)
jle    128e <main+0x10e>
xor    %ebx,%ebx
lea    0xdce(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  (%r15,%rbx,8),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     1270 <main+0xf0>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Initialized, matrix %x, mesh %x\0A\00"
@.str.1 = [17 x i8] c"result size=%d:\0A\00"
@.str.2 = [4 x i8] c"%f \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca double*
%11 = alloca double*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %12
store i32 1, i32* %13
%15 = call i8* @malloc(i64 1800)
%16 = bitcast i8* %15 to double*
store double* %16, double** %10
%17 = call i8* @malloc(i64 1800)
%18 = bitcast i8* %17 to double*
store double* %18, double** %11
%19 = call i32 (i32*, ...) bitcast (i32 (...)* @ext_doug_init_ to i32 (i32*, ...)*)(i32* %13)
%20 = call i32 (i8**, ...) bitcast (i32 (...)* @alloc_spmtx_ to i32 (i8**, ...)*)(i8** %7)
%21 = call i32 (i8**, ...) bitcast (i32 (...)* @alloc_spmtx_ to i32 (i8**, ...)*)(i8** %8)
%22 = call i32 (i8**, ...) bitcast (i32 (...)* @alloc_mesh_ to i32 (i8**, ...)*)(i8** %9)
%23 = load i8*, i8** %7
%24 = load i8*, i8** %9
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %23, i8* %24)
%26 = load i8*, i8** %9
%27 = load i8*, i8** %7
%28 = load double*, double** %11
%29 = load i8*, i8** %8
%30 = call i32 (i8*, i8*, double*, i32*, i8*, i32*, ...) bitcast (i32 (...)* @ext_paralleldistributeinput_ to i32 (i8*, i8*, double*, i32*, i8*, i32*, ...)*)(i8* %26, i8* %27, double* %28, i32* %12, i8* %29, i32* %14)
%31 = load i8*, i8** %7
%32 = load double*, double** %11
%33 = load i8*, i8** %9
%34 = load double*, double** %10
%35 = call i32 (i8*, double*, i8*, double*, i32*, ...) bitcast (i32 (...)* @ext_cg_ to i32 (i8*, double*, i8*, double*, i32*, ...)*)(i8* %31, double* %32, i8* %33, double* %34, i32* %14)
%36 = call i32 (...) @ext_doug_finalize_()
%37 = load i32, i32* %14
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %37)
store i32 0, i32* %6
br label %39
39: ; preds = %50, %2
%40 = load i32, i32* %6
%41 = load i32, i32* %14
%42 = icmp slt i32 %40, %41
br i1 %42, label %43, label %53
43: ; preds = %39
%44 = load double*, double** %10
%45 = load i32, i32* %6
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds double, double* %44, i64 %46
%48 = load double, double* %47
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double %48)
br label %50
50: ; preds = %43
%51 = load i32, i32* %6
%52 = add nsw i32 %51, 1
store i32 %52, i32* %6
br label %39
53: ; preds = %39
ret i32 0
}

LLVM IR (-O2):
@.str = [33 x i8] c"Initialized, matrix %x, mesh %x\0A\00"
@.str.1 = [17 x i8] c"result size=%d:\0A\00"
@.str.2 = [4 x i8] c"%f \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = bitcast i8** %3 to i8*
%10 = bitcast i8** %4 to i8*
%11 = bitcast i8** %5 to i8*
%12 = bitcast i32* %6 to i8*
store i32 1, i32* %6
%13 = bitcast i32* %7 to i8*
store i32 1, i32* %7
%14 = bitcast i32* %8 to i8*
%15 = tail call dereferenceable_or_null(1800) i8* @malloc(i64 1800)
%16 = bitcast i8* %15 to double*
%17 = tail call dereferenceable_or_null(1800) i8* @malloc(i64 1800)
%18 = bitcast i8* %17 to double*
%19 = call i32 (i32*, ...) bitcast (i32 (...)* @ext_doug_init_ to i32 (i32*, ...)*)(i32* %7)
%20 = call i32 (i8**, ...) bitcast (i32 (...)* @alloc_spmtx_ to i32 (i8**, ...)*)(i8** %3)
%21 = call i32 (i8**, ...) bitcast (i32 (...)* @alloc_spmtx_ to i32 (i8**, ...)*)(i8** %4)
%22 = call i32 (i8**, ...) bitcast (i32 (...)* @alloc_mesh_ to i32 (i8**, ...)*)(i8** %5)
%23 = load i8*, i8** %3
%24 = load i8*, i8** %5
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %23, i8* %24)
%26 = load i8*, i8** %5
%27 = load i8*, i8** %3
%28 = load i8*, i8** %4
%29 = call i32 (i8*, i8*, double*, i32*, i8*, i32*, ...) bitcast (i32 (...)* @ext_paralleldistributeinput_ to i32 (i8*, i8*, double*, i32*, i8*, i32*, ...)*)(i8* %26, i8* %27, double* %18, i32* %6, i8* %28, i32* %8)
%30 = load i8*, i8** %3
%31 = load i8*, i8** %5
%32 = call i32 (i8*, double*, i8*, double*, i32*, ...) bitcast (i32 (...)* @ext_cg_ to i32 (i8*, double*, i8*, double*, i32*, ...)*)(i8* %30, double* %18, i8* %31, double* %16, i32* %8)
%33 = call i32 (...) @ext_doug_finalize_()
%34 = load i32, i32* %8
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %34)
%36 = load i32, i32* %8
%37 = icmp sgt i32 %36, 0
br i1 %37, label %38, label %47
38: ; preds = %2, %38
%39 = phi i64 [ %43, %38 ], [ 0, %2 ]
%40 = getelementptr inbounds double, double* %16, i64 %39
%41 = load double, double* %40
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double %41)
%43 = add nuw nsw i64 %39, 1
%44 = load i32, i32* %8
%45 = sext i32 %44 to i64
%46 = icmp slt i64 %43, %45
br i1 %46, label %38, label %47
47: ; preds = %38, %2
ret i32 0
}