#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 monotonic_decrease(int *, int);
int monotonic_increase(int *, int);
int one_concave_peak(int *, int);
int one_convex_peak(int *, int);
int classify_graph_function(int *ordg, int filenum) {
  int flag;
  flag = 0;
  flag = monotonic_decrease(ordg, filenum);
  if (flag == 1)
    return 1;
  flag = 0;
  flag = monotonic_increase(ordg, filenum);
  if (flag == 1)
    return 2;
  flag = 0;
  flag = one_convex_peak(ordg, filenum);
  if (flag == 1)
    return 3;
  flag = 0;
  flag = one_concave_peak(ordg, filenum);
  if (flag == 1)
    return 4;
  return 5;
}


x86 assembly (clang, -O0):
<classify_graph_function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <monotonic_decrease@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x1,-0x18(%rbp)
jne    117b <classify_graph_function+0x3b>
movl   $0x1,-0x4(%rbp)
jmp    1206 <classify_graph_function+0xc6>
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <monotonic_increase@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x1,-0x18(%rbp)
jne    11a7 <classify_graph_function+0x67>
movl   $0x2,-0x4(%rbp)
jmp    1206 <classify_graph_function+0xc6>
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1060 <one_convex_peak@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x1,-0x18(%rbp)
jne    11d3 <classify_graph_function+0x93>
movl   $0x3,-0x4(%rbp)
jmp    1206 <classify_graph_function+0xc6>
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <one_concave_peak@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x1,-0x18(%rbp)
jne    11ff <classify_graph_function+0xbf>
movl   $0x4,-0x4(%rbp)
jmp    1206 <classify_graph_function+0xc6>
movl   $0x5,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<classify_graph_function>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1050 <monotonic_decrease@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    $0x1,%ecx
je     119c <classify_graph_function+0x5c>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1040 <monotonic_increase@plt>
mov    %eax,%ecx
mov    $0x2,%eax
cmp    $0x1,%ecx
je     119c <classify_graph_function+0x5c>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1060 <one_convex_peak@plt>
mov    %eax,%ecx
mov    $0x3,%eax
cmp    $0x1,%ecx
je     119c <classify_graph_function+0x5c>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <one_concave_peak@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
sete   %al
xor    $0x5,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @classify_graph_function(i32* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 0, i32* %6
%7 = load i32*, i32** %4
%8 = load i32, i32* %5
%9 = call i32 @monotonic_decrease(i32* %7, i32 %8)
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 1, i32* %3
br label %35
13: ; preds = %2
store i32 0, i32* %6
%14 = load i32*, i32** %4
%15 = load i32, i32* %5
%16 = call i32 @monotonic_increase(i32* %14, i32 %15)
store i32 %16, i32* %6
%17 = load i32, i32* %6
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %20
19: ; preds = %13
store i32 2, i32* %3
br label %35
20: ; preds = %13
store i32 0, i32* %6
%21 = load i32*, i32** %4
%22 = load i32, i32* %5
%23 = call i32 @one_convex_peak(i32* %21, i32 %22)
store i32 %23, i32* %6
%24 = load i32, i32* %6
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %27
26: ; preds = %20
store i32 3, i32* %3
br label %35
27: ; preds = %20
store i32 0, i32* %6
%28 = load i32*, i32** %4
%29 = load i32, i32* %5
%30 = call i32 @one_concave_peak(i32* %28, i32 %29)
store i32 %30, i32* %6
%31 = load i32, i32* %6
%32 = icmp eq i32 %31, 1
br i1 %32, label %33, label %34
33: ; preds = %27
store i32 4, i32* %3
br label %35
34: ; preds = %27
store i32 5, i32* %3
br label %35
35: ; preds = %34, %33, %26, %19, %12
%36 = load i32, i32* %3
ret i32 %36
}

LLVM IR (-O2):
define i32 @classify_graph_function(i32* %0, i32 %1) {
%3 = tail call i32 @monotonic_decrease(i32* %0, i32 %1)
%4 = icmp eq i32 %3, 1
br i1 %4, label %15, label %5
5: ; preds = %2
%6 = tail call i32 @monotonic_increase(i32* %0, i32 %1)
%7 = icmp eq i32 %6, 1
br i1 %7, label %15, label %8
8: ; preds = %5
%9 = tail call i32 @one_convex_peak(i32* %0, i32 %1)
%10 = icmp eq i32 %9, 1
br i1 %10, label %15, label %11
11: ; preds = %8
%12 = tail call i32 @one_concave_peak(i32* %0, i32 %1)
%13 = icmp eq i32 %12, 1
%14 = select i1 %13, i32 4, i32 5
br label %15
15: ; preds = %11, %8, %5, %2
%16 = phi i32 [ 1, %2 ], [ 2, %5 ], [ 3, %8 ], [ %14, %11 ]
ret i32 %16
}