#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 comp {
  int dummy;
};
struct BrzFetch_ {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ COPY_DATA_FROM_TO(int, int);
int /*<<< orphan*/ SEND_ACKUP(int /*<<< orphan*/);
int /*<<< orphan*/ SEND_DATAON_DELAYED(int, int /*<<< orphan*/);
int /*<<< orphan*/ SEND_REQUP_DELAYED(int, int);
int /*<<< orphan*/ TRACE_FOLLOW_THREAD(int, int /*<<< orphan*/);
void BrzFetch_ackup(struct comp *comp, int port) {
  struct BrzFetch_ *c = (struct BrzFetch_ *)comp;
  switch (port) {
  case 1:
    COPY_DATA_FROM_TO(1, 2);
    TRACE_FOLLOW_THREAD(2, 0);
    SEND_DATAON_DELAYED(2, 0);
    SEND_REQUP_DELAYED(2, 1);
    break;
  case 2:
    SEND_ACKUP(0);
    break;
  }
}


x86 assembly (clang, -O0):
<BrzFetch_ackup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x1,%eax
je     118c <BrzFetch_ackup+0x3c>
jmp    117b <BrzFetch_ackup+0x2b>
mov    -0x1c(%rbp),%eax
sub    $0x2,%eax
je     11c7 <BrzFetch_ackup+0x77>
jmp    11ce <BrzFetch_ackup+0x7e>
mov    $0x1,%edi
mov    $0x2,%esi
call   1060 <COPY_DATA_FROM_TO@plt>
mov    $0x2,%edi
xor    %esi,%esi
call   1040 <TRACE_FOLLOW_THREAD@plt>
mov    $0x2,%edi
xor    %esi,%esi
call   1030 <SEND_DATAON_DELAYED@plt>
mov    $0x2,%edi
mov    $0x1,%esi
call   1070 <SEND_REQUP_DELAYED@plt>
jmp    11ce <BrzFetch_ackup+0x7e>
xor    %edi,%edi
call   1050 <SEND_ACKUP@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BrzFetch_ackup>:
cmp    $0x2,%esi
je     1192 <BrzFetch_ackup+0x42>
cmp    $0x1,%esi
jne    1199 <BrzFetch_ackup+0x49>
push   %rax
mov    $0x1,%edi
mov    $0x2,%esi
call   1060 <COPY_DATA_FROM_TO@plt>
mov    $0x2,%edi
xor    %esi,%esi
call   1040 <TRACE_FOLLOW_THREAD@plt>
mov    $0x2,%edi
xor    %esi,%esi
call   1030 <SEND_DATAON_DELAYED@plt>
mov    $0x2,%edi
mov    $0x1,%esi
pop    %rax
jmp    1070 <SEND_REQUP_DELAYED@plt>
xor    %edi,%edi
jmp    1050 <SEND_ACKUP@plt>
ret

LLVM IR (-O0):
%struct.comp = type { i32 }
%struct.BrzFetch_ = type { i32 }
define void @BrzFetch_ackup(%struct.comp* %0, i32 %1) {
%3 = alloca %struct.comp*
%4 = alloca i32
%5 = alloca %struct.BrzFetch_*
store %struct.comp* %0, %struct.comp** %3
store i32 %1, i32* %4
%6 = load %struct.comp*, %struct.comp** %3
%7 = bitcast %struct.comp* %6 to %struct.BrzFetch_*
store %struct.BrzFetch_* %7, %struct.BrzFetch_** %5
%8 = load i32, i32* %4
switch i32 %8, label %16 [
i32 1, label %9
i32 2, label %14
]
9: ; preds = %2
%10 = call i32 @COPY_DATA_FROM_TO(i32 1, i32 2)
%11 = call i32 @TRACE_FOLLOW_THREAD(i32 2, i32 0)
%12 = call i32 @SEND_DATAON_DELAYED(i32 2, i32 0)
%13 = call i32 @SEND_REQUP_DELAYED(i32 2, i32 1)
br label %16
14: ; preds = %2
%15 = call i32 @SEND_ACKUP(i32 0)
br label %16
16: ; preds = %2, %14, %9
ret void
}

LLVM IR (-O2):
%struct.comp = type { i32 }
define void @BrzFetch_ackup(%struct.comp* nocapture readnone %0, i32 %1) {
switch i32 %1, label %10 [
i32 1, label %3
i32 2, label %8
]
3: ; preds = %2
%4 = tail call i32 @COPY_DATA_FROM_TO(i32 1, i32 2)
%5 = tail call i32 @TRACE_FOLLOW_THREAD(i32 2, i32 0)
%6 = tail call i32 @SEND_DATAON_DELAYED(i32 2, i32 0)
%7 = tail call i32 @SEND_REQUP_DELAYED(i32 2, i32 1)
br label %10
8: ; preds = %2
%9 = tail call i32 @SEND_ACKUP(i32 0)
br label %10
10: ; preds = %2, %8, %3
ret void
}