#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, int, int, int);
int /*<<< orphan*/ sp_assertion_failed(char *, int, char *);
int /*<<< orphan*/ sp_expectation_failed(char *, int, char *);
int sp_load_int_vector(int **, int *, char *);
int *spcalloc(int, int);
int /*<<< orphan*/ spfree(int *);
int /*<<< orphan*/ tree_postorder_perm(int *, int, int *);
void big_etree_postorder() {
  int result;
  int *etree = 0;
  int *post_expected = 0;
  int *post = 0;
  int size, i;
  {
    if (!((result = sp_load_int_vector(&etree, &size, "data/big_etree.txt"))))
      sp_expectation_failed(
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/fourier/libspmatrix/refs/heads/master/"
          "test_src/test_main.c",
          1602,
          "(result = sp_load_int_vector(&etree, &size, "
          "\"data/big_etree.txt\"))");
  };
  if (result) {
    {
      if (!((result = sp_load_int_vector(&post_expected, &i,
                                         "data/big_etree_postorder.txt"))))
        sp_expectation_failed(
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/fourier/libspmatrix/refs/heads/master/"
            "test_src/test_main.c",
            1607,
            "(result = sp_load_int_vector(&post_expected,&i, "
            "\"data/big_etree_postorder.txt\"))");
    };
    if (result) {
      {
        if (!(size == i))
          sp_assertion_failed(
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/fourier/libspmatrix/refs/heads/master/"
              "test_src/test_main.c",
              1611, "size == i");
      };
      post = spcalloc(size, sizeof(int));
      tree_postorder_perm(etree, size, post);
      for (i = 0; i < size; ++i) {
        if (post[i] != post_expected[i]) {
          printf("Error! post[%d] = %d not equal post_expected[%d] = %d\n", i,
                 post[i], i, post_expected[i]);
        }
        {
          if (!(post[i] == post_expected[i]))
            sp_assertion_failed(
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/fourier/libspmatrix/refs/"
                "heads/master/test_src/test_main.c",
                1621, "post[i] == post_expected[i]");
        };
      }
    }
  }
  spfree(etree);
  spfree(post_expected);
  spfree(post);
}


x86 assembly (clang, -O0):
<big_etree_postorder>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
lea    -0x10(%rbp),%rdi
lea    -0x24(%rbp),%rsi
lea    0xe61(%rip),%rdx
call   1080 <sp_load_int_vector@plt>
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
jne    11c8 <big_etree_postorder+0x58>
lea    0xe5c(%rip),%rdi
mov    $0x642,%esi
lea    0xee5(%rip),%rdx
call   1070 <sp_expectation_failed@plt>
cmpl   $0x0,-0x4(%rbp)
je     1302 <big_etree_postorder+0x192>
lea    -0x18(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    0xf0a(%rip),%rdx
call   1080 <sp_load_int_vector@plt>
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
jne    120a <big_etree_postorder+0x9a>
lea    0xe1a(%rip),%rdi
mov    $0x647,%esi
lea    0xf03(%rip),%rdx
call   1070 <sp_expectation_failed@plt>
cmpl   $0x0,-0x4(%rbp)
je     12fd <big_etree_postorder+0x18d>
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
je     1238 <big_etree_postorder+0xc8>
lea    0xdec(%rip),%rdi
mov    $0x64b,%esi
lea    0xf26(%rip),%rdx
call   1040 <sp_assertion_failed@plt>
mov    -0x24(%rbp),%edi
mov    $0x4,%esi
call   1030 <spcalloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1090 <tree_postorder_perm@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    12f8 <big_etree_postorder+0x188>
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x18(%rbp),%rcx
movslq -0x28(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
je     12b1 <big_etree_postorder+0x141>
mov    -0x28(%rbp),%esi
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x28(%rbp),%ecx
mov    -0x18(%rbp),%rax
movslq -0x28(%rbp),%rdi
mov    (%rax,%rdi,4),%r8d
lea    0xeb7(%rip),%rdi
call   1060 <printf@plt>
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x18(%rbp),%rcx
movslq -0x28(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
je     12e5 <big_etree_postorder+0x175>
lea    0xd3f(%rip),%rdi
mov    $0x655,%esi
lea    0xeba(%rip),%rdx
call   1040 <sp_assertion_failed@plt>
jmp    12ea <big_etree_postorder+0x17a>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1260 <big_etree_postorder+0xf0>
jmp    12fd <big_etree_postorder+0x18d>
jmp    1302 <big_etree_postorder+0x192>
mov    -0x10(%rbp),%rdi
call   1050 <spfree@plt>
mov    -0x18(%rbp),%rdi
call   1050 <spfree@plt>
mov    -0x20(%rbp),%rdi
call   1050 <spfree@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<big_etree_postorder>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
movq   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
lea    0xe6c(%rip),%rdx
lea    0x10(%rsp),%rdi
lea    0x4(%rsp),%rsi
call   1080 <sp_load_int_vector@plt>
test   %eax,%eax
je     1290 <big_etree_postorder+0x120>
lea    0xf39(%rip),%rdx
lea    0x8(%rsp),%rdi
mov    %rsp,%rsi
call   1080 <sp_load_int_vector@plt>
test   %eax,%eax
je     12a5 <big_etree_postorder+0x135>
mov    0x4(%rsp),%edi
cmp    (%rsp),%edi
je     11ec <big_etree_postorder+0x7c>
lea    0xe3c(%rip),%rdi
lea    0xf7b(%rip),%rdx
mov    $0x64b,%esi
call   1040 <sp_assertion_failed@plt>
mov    0x4(%rsp),%edi
mov    $0x4,%esi
call   1030 <spcalloc@plt>
mov    %rax,%rbx
mov    0x10(%rsp),%rdi
mov    0x4(%rsp),%esi
mov    %rax,%rdx
call   1090 <tree_postorder_perm@plt>
movl   $0x0,(%rsp)
cmpl   $0x0,0x4(%rsp)
jle    12bf <big_etree_postorder+0x14f>
xor    %ecx,%ecx
lea    0xf3e(%rip),%r14
lea    0xde7(%rip),%r15
lea    0xf67(%rip),%r12
jmp    124c <big_etree_postorder+0xdc>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ecx
mov    %ecx,(%rsp)
cmp    0x4(%rsp),%ecx
jge    12bf <big_etree_postorder+0x14f>
movslq %ecx,%rax
mov    (%rbx,%rax,4),%edx
mov    0x8(%rsp),%rsi
mov    (%rsi,%rax,4),%r8d
cmp    %r8d,%edx
je     1240 <big_etree_postorder+0xd0>
mov    %r14,%rdi
mov    %ecx,%esi
call   1060 <printf@plt>
movslq (%rsp),%rcx
mov    (%rbx,%rcx,4),%eax
mov    0x8(%rsp),%rdx
cmp    (%rdx,%rcx,4),%eax
je     1240 <big_etree_postorder+0xd0>
mov    %r15,%rdi
mov    $0x655,%esi
mov    %r12,%rdx
call   1040 <sp_assertion_failed@plt>
mov    (%rsp),%ecx
jmp    1240 <big_etree_postorder+0xd0>
lea    0xd7c(%rip),%rdi
lea    0xe0a(%rip),%rdx
mov    $0x642,%esi
jmp    12b8 <big_etree_postorder+0x148>
lea    0xd67(%rip),%rdi
lea    0xe55(%rip),%rdx
mov    $0x647,%esi
call   1070 <sp_expectation_failed@plt>
xor    %ebx,%ebx
mov    0x10(%rsp),%rdi
call   1050 <spfree@plt>
mov    0x8(%rsp),%rdi
call   1050 <spfree@plt>
mov    %rbx,%rdi
call   1050 <spfree@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [19 x i8] c"data/big_etree.txt\00"
@.str.1 = [149 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fourier/libspmatrix/refs/heads/master/test_src/test_main.c\00"
@.str.2 = [67 x i8] c"(result = sp_load_int_vector(&etree, &size, \22data/big_etree.txt\22))\00"
@.str.3 = [29 x i8] c"data/big_etree_postorder.txt\00"
@.str.4 = [81 x i8] c"(result = sp_load_int_vector(&post_expected,&i, \22data/big_etree_postorder.txt\22))\00"
@.str.5 = [10 x i8] c"size == i\00"
@.str.6 = [55 x i8] c"Error! post[%d] = %d not equal post_expected[%d] = %d\0A\00"
@.str.7 = [28 x i8] c"post[i] == post_expected[i]\00"
define void @big_etree_postorder() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* null, i32** %2
store i32* null, i32** %3
store i32* null, i32** %4
%7 = call i32 @sp_load_int_vector(i32** %2, i32* %5, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i32 %7, i32* %1
%8 = icmp ne i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %0
%10 = call i32 @sp_expectation_failed(i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.1, i64 0, i64 0), i32 1602, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.2, i64 0, i64 0))
br label %11
11: ; preds = %9, %0
%12 = load i32, i32* %1
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %85
14: ; preds = %11
%15 = call i32 @sp_load_int_vector(i32** %3, i32* %6, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
store i32 %15, i32* %1
%16 = icmp ne i32 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %14
%18 = call i32 @sp_expectation_failed(i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.1, i64 0, i64 0), i32 1607, i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str.4, i64 0, i64 0))
br label %19
19: ; preds = %17, %14
%20 = load i32, i32* %1
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %84
22: ; preds = %19
%23 = load i32, i32* %5
%24 = load i32, i32* %6
%25 = icmp eq i32 %23, %24
br i1 %25, label %28, label %26
26: ; preds = %22
%27 = call i32 @sp_assertion_failed(i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.1, i64 0, i64 0), i32 1611, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
br label %28
28: ; preds = %26, %22
%29 = load i32, i32* %5
%30 = call i32* @spcalloc(i32 %29, i32 4)
store i32* %30, i32** %4
%31 = load i32*, i32** %2
%32 = load i32, i32* %5
%33 = load i32*, i32** %4
%34 = call i32 @tree_postorder_perm(i32* %31, i32 %32, i32* %33)
store i32 0, i32* %6
br label %35
35: ; preds = %80, %28
%36 = load i32, i32* %6
%37 = load i32, i32* %5
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %83
39: ; preds = %35
%40 = load i32*, i32** %4
%41 = load i32, i32* %6
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i32, i32* %40, i64 %42
%44 = load i32, i32* %43
%45 = load i32*, i32** %3
%46 = load i32, i32* %6
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i32, i32* %45, i64 %47
%49 = load i32, i32* %48
%50 = icmp ne i32 %44, %49
br i1 %50, label %51, label %65
51: ; preds = %39
%52 = load i32, i32* %6
%53 = load i32*, i32** %4
%54 = load i32, i32* %6
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i32, i32* %53, i64 %55
%57 = load i32, i32* %56
%58 = load i32, i32* %6
%59 = load i32*, i32** %3
%60 = load i32, i32* %6
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i32, i32* %59, i64 %61
%63 = load i32, i32* %62
%64 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.6, i64 0, i64 0), i32 %52, i32 %57, i32 %58, i32 %63)
br label %65
65: ; preds = %51, %39
%66 = load i32*, i32** %4
%67 = load i32, i32* %6
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i32, i32* %66, i64 %68
%70 = load i32, i32* %69
%71 = load i32*, i32** %3
%72 = load i32, i32* %6
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds i32, i32* %71, i64 %73
%75 = load i32, i32* %74
%76 = icmp eq i32 %70, %75
br i1 %76, label %79, label %77
77: ; preds = %65
%78 = call i32 @sp_assertion_failed(i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.1, i64 0, i64 0), i32 1621, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0))
br label %79
79: ; preds = %77, %65
br label %80
80: ; preds = %79
%81 = load i32, i32* %6
%82 = add nsw i32 %81, 1
store i32 %82, i32* %6
br label %35
83: ; preds = %35
br label %84
84: ; preds = %83, %19
br label %85
85: ; preds = %84, %11
%86 = load i32*, i32** %2
%87 = call i32 @spfree(i32* %86)
%88 = load i32*, i32** %3
%89 = call i32 @spfree(i32* %88)
%90 = load i32*, i32** %4
%91 = call i32 @spfree(i32* %90)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"data/big_etree.txt\00"
@.str.1 = [149 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fourier/libspmatrix/refs/heads/master/test_src/test_main.c\00"
@.str.2 = [67 x i8] c"(result = sp_load_int_vector(&etree, &size, \22data/big_etree.txt\22))\00"
@.str.3 = [29 x i8] c"data/big_etree_postorder.txt\00"
@.str.4 = [81 x i8] c"(result = sp_load_int_vector(&post_expected,&i, \22data/big_etree_postorder.txt\22))\00"
@.str.5 = [10 x i8] c"size == i\00"
@.str.6 = [55 x i8] c"Error! post[%d] = %d not equal post_expected[%d] = %d\0A\00"
@.str.7 = [28 x i8] c"post[i] == post_expected[i]\00"
define void @big_etree_postorder() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32** %1 to i8*
store i32* null, i32** %1
%6 = bitcast i32** %2 to i8*
store i32* null, i32** %2
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = call i32 @sp_load_int_vector(i32** %1, i32* %3, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 @sp_expectation_failed(i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.1, i64 0, i64 0), i32 1602, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.2, i64 0, i64 0))
br label %60
13: ; preds = %0
%14 = call i32 @sp_load_int_vector(i32** %2, i32* %4, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 @sp_expectation_failed(i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.1, i64 0, i64 0), i32 1607, i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str.4, i64 0, i64 0))
br label %60
18: ; preds = %13
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = icmp eq i32 %19, %20
br i1 %21, label %25, label %22
22: ; preds = %18
%23 = call i32 @sp_assertion_failed(i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.1, i64 0, i64 0), i32 1611, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%24 = load i32, i32* %3
br label %25
25: ; preds = %22, %18
%26 = phi i32 [ %24, %22 ], [ %19, %18 ]
%27 = call i32* @spcalloc(i32 %26, i32 4)
%28 = load i32*, i32** %1
%29 = load i32, i32* %3
%30 = call i32 @tree_postorder_perm(i32* %28, i32 %29, i32* %27)
store i32 0, i32* %4
%31 = load i32, i32* %3
%32 = icmp sgt i32 %31, 0
br i1 %32, label %33, label %60
33: ; preds = %25, %55
%34 = phi i32 [ %57, %55 ], [ 0, %25 ]
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i32, i32* %27, i64 %35
%37 = load i32, i32* %36
%38 = load i32*, i32** %2
%39 = getelementptr inbounds i32, i32* %38, i64 %35
%40 = load i32, i32* %39
%41 = icmp eq i32 %37, %40
br i1 %41, label %55, label %42
42: ; preds = %33
%43 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.6, i64 0, i64 0), i32 %34, i32 %37, i32 %34, i32 %40)
%44 = load i32, i32* %4
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i32, i32* %27, i64 %45
%47 = load i32, i32* %46
%48 = load i32*, i32** %2
%49 = getelementptr inbounds i32, i32* %48, i64 %45
%50 = load i32, i32* %49
%51 = icmp eq i32 %47, %50
br i1 %51, label %55, label %52
52: ; preds = %42
%53 = call i32 @sp_assertion_failed(i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.1, i64 0, i64 0), i32 1621, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0))
%54 = load i32, i32* %4
br label %55
55: ; preds = %33, %42, %52
%56 = phi i32 [ %44, %42 ], [ %54, %52 ], [ %34, %33 ]
%57 = add nsw i32 %56, 1
store i32 %57, i32* %4
%58 = load i32, i32* %3
%59 = icmp slt i32 %57, %58
br i1 %59, label %33, label %60
60: ; preds = %55, %25, %16, %11
%61 = phi i32* [ null, %16 ], [ null, %11 ], [ %27, %25 ], [ %27, %55 ]
%62 = load i32*, i32** %1
%63 = call i32 @spfree(i32* %62)
%64 = load i32*, i32** %2
%65 = call i32 @spfree(i32* %64)
%66 = call i32 @spfree(i32* %61)
ret void
}