#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 */
struct graph_display {
  int dummy;
};
struct bio_graph {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ __finalize_step(struct graph_display *);
int /*<<< orphan*/ __preparation_step(struct graph_display *,
                                      struct bio_graph *);
int __simulation_step(struct graph_display *, int);
void graph_display_force_directed(struct graph_display *self,
                                  struct bio_graph *g, int max_steps) {
  __preparation_step(self, g);
  int i, j;
  for (i = 0, j = 0; j < max_steps && i != -1; j++) {
    i = __simulation_step(self, i);
  }
  __finalize_step(self);
}


x86 assembly (clang, -O0):
<graph_display_force_directed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <__preparation_step@plt>
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%ecx
xor    %eax,%eax
cmp    -0x14(%rbp),%ecx
mov    %al,-0x1d(%rbp)
jge    1179 <graph_display_force_directed+0x49>
cmpl   $0xffffffff,-0x18(%rbp)
setne  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    1189 <graph_display_force_directed+0x59>
jmp    11a6 <graph_display_force_directed+0x76>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1040 <__simulation_step@plt>
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    115e <graph_display_force_directed+0x2e>
mov    -0x8(%rbp),%rdi
call   1030 <__finalize_step@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<graph_display_force_directed>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rdi,%rbx
call   1050 <__preparation_step@plt>
test   %r14d,%r14d
jle    1167 <graph_display_force_directed+0x37>
xor    %eax,%eax
mov    $0x1,%ebp
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <__simulation_step@plt>
cmp    %r14d,%ebp
jge    1167 <graph_display_force_directed+0x37>
add    $0x1,%ebp
cmp    $0xffffffff,%eax
jne    1150 <graph_display_force_directed+0x20>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <__finalize_step@plt>

LLVM IR (-O0):
%struct.graph_display = type { i32 }
%struct.bio_graph = type { i32 }
define void @graph_display_force_directed(%struct.graph_display* %0, %struct.bio_graph* %1, i32 %2) {
%4 = alloca %struct.graph_display*
%5 = alloca %struct.bio_graph*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store %struct.graph_display* %0, %struct.graph_display** %4
store %struct.bio_graph* %1, %struct.bio_graph** %5
store i32 %2, i32* %6
%9 = load %struct.graph_display*, %struct.graph_display** %4
%10 = load %struct.bio_graph*, %struct.bio_graph** %5
%11 = call i32 @__preparation_step(%struct.graph_display* %9, %struct.bio_graph* %10)
store i32 0, i32* %7
store i32 0, i32* %8
br label %12
12: ; preds = %25, %3
%13 = load i32, i32* %8
%14 = load i32, i32* %6
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %19
16: ; preds = %12
%17 = load i32, i32* %7
%18 = icmp ne i32 %17, -1
br label %19
19: ; preds = %16, %12
%20 = phi i1 [ false, %12 ], [ %18, %16 ]
br i1 %20, label %21, label %28
21: ; preds = %19
%22 = load %struct.graph_display*, %struct.graph_display** %4
%23 = load i32, i32* %7
%24 = call i32 @__simulation_step(%struct.graph_display* %22, i32 %23)
store i32 %24, i32* %7
br label %25
25: ; preds = %21
%26 = load i32, i32* %8
%27 = add nsw i32 %26, 1
store i32 %27, i32* %8
br label %12
28: ; preds = %19
%29 = load %struct.graph_display*, %struct.graph_display** %4
%30 = call i32 @__finalize_step(%struct.graph_display* %29)
ret void
}

LLVM IR (-O2):
%struct.graph_display = type { i32 }
%struct.bio_graph = type { i32 }
define void @graph_display_force_directed(%struct.graph_display* %0, %struct.bio_graph* %1, i32 %2) {
%4 = tail call i32 @__preparation_step(%struct.graph_display* %0, %struct.bio_graph* %1)
%5 = icmp sgt i32 %2, 0
br i1 %5, label %6, label %14
6: ; preds = %3, %6
%7 = phi i32 [ %10, %6 ], [ 0, %3 ]
%8 = phi i32 [ %9, %6 ], [ 0, %3 ]
%9 = tail call i32 @__simulation_step(%struct.graph_display* %0, i32 %8)
%10 = add nuw nsw i32 %7, 1
%11 = icmp slt i32 %10, %2
%12 = icmp ne i32 %9, -1
%13 = select i1 %11, i1 %12, i1 false
br i1 %13, label %6, label %14
14: ; preds = %6, %3
%15 = tail call i32 @__finalize_step(%struct.graph_display* %0)
ret void
}