#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*/ count_between_down(int, int);
int /*<<< orphan*/ count_between_up(int, int);
int /*<<< orphan*/ count_down(int);
int /*<<< orphan*/ count_up(int);
int userinput1();
int userinput2();
void task1(void) {
  int userin1 = userinput1();
  int userin2 = userinput2();
  count_up(userin1);
  count_down(userin1);
  if (userin1 < userin2) {
    count_between_up(userin1, userin2);
  } else if (userin1 > userin2) {
    count_between_down(userin1, userin2);
  }
}


x86 assembly (clang, -O0):
<task1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <userinput1@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1070 <userinput2@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <count_up@plt>
mov    -0x4(%rbp),%edi
call   1060 <count_down@plt>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11a8 <task1+0x48>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1080 <count_between_up@plt>
jmp    11c4 <task1+0x64>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    11bf <task1+0x5f>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <count_between_down@plt>
jmp    11c4 <task1+0x64>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<task1>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <userinput1@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1070 <userinput2@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1050 <count_up@plt>
mov    %ebx,%edi
call   1060 <count_down@plt>
cmp    %ebp,%ebx
jge    1196 <task1+0x36>
mov    %ebx,%edi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1080 <count_between_up@plt>
jle    11a7 <task1+0x47>
mov    %ebx,%edi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <count_between_down@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @task1() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @userinput1()
store i32 %3, i32* %1
%4 = call i32 (...) @userinput2()
store i32 %4, i32* %2
%5 = load i32, i32* %1
%6 = call i32 @count_up(i32 %5)
%7 = load i32, i32* %1
%8 = call i32 @count_down(i32 %7)
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %16
12: ; preds = %0
%13 = load i32, i32* %1
%14 = load i32, i32* %2
%15 = call i32 @count_between_up(i32 %13, i32 %14)
br label %25
16: ; preds = %0
%17 = load i32, i32* %1
%18 = load i32, i32* %2
%19 = icmp sgt i32 %17, %18
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = load i32, i32* %1
%22 = load i32, i32* %2
%23 = call i32 @count_between_down(i32 %21, i32 %22)
br label %24
24: ; preds = %20, %16
br label %25
25: ; preds = %24, %12
ret void
}

LLVM IR (-O2):
define void @task1() {
%1 = tail call i32 (...) @userinput1()
%2 = tail call i32 (...) @userinput2()
%3 = tail call i32 @count_up(i32 %1)
%4 = tail call i32 @count_down(i32 %1)
%5 = icmp slt i32 %1, %2
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = tail call i32 @count_between_up(i32 %1, i32 %2)
br label %12
8: ; preds = %0
%9 = icmp sgt i32 %1, %2
br i1 %9, label %10, label %12
10: ; preds = %8
%11 = tail call i32 @count_between_down(i32 %1, i32 %2)
br label %12
12: ; preds = %8, %10, %6
ret void
}