#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*/ SEND_ACKDOWN_DELAYED(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ SEND_DATAOFF_DELAYED(int, int);
int /*<<< orphan*/ SEND_REQDOWN_DELAYED(int, int /*<<< orphan*/);
void BrzFetch_ackdown(struct comp *comp, int port) {
  struct BrzFetch_ *c = (struct BrzFetch_ *)comp;
  switch (port) {
  case 1:
    SEND_REQDOWN_DELAYED(2, 0);
    SEND_DATAOFF_DELAYED(2, 1);
    break;
  case 2:
    SEND_ACKDOWN_DELAYED(0, 0);
    break;
  }
}


x86 assembly (clang, -O0):
<BrzFetch_ackdown>:
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     116c <BrzFetch_ackdown+0x3c>
jmp    115b <BrzFetch_ackdown+0x2b>
mov    -0x1c(%rbp),%eax
sub    $0x2,%eax
je     118c <BrzFetch_ackdown+0x5c>
jmp    1195 <BrzFetch_ackdown+0x65>
mov    $0x2,%edi
xor    %esi,%esi
call   1050 <SEND_REQDOWN_DELAYED@plt>
mov    $0x2,%edi
mov    $0x1,%esi
call   1040 <SEND_DATAOFF_DELAYED@plt>
jmp    1195 <BrzFetch_ackdown+0x65>
xor    %esi,%esi
mov    %esi,%edi
call   1030 <SEND_ACKDOWN_DELAYED@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BrzFetch_ackdown>:
cmp    $0x2,%esi
je     1157 <BrzFetch_ackdown+0x27>
cmp    $0x1,%esi
jne    1160 <BrzFetch_ackdown+0x30>
push   %rax
mov    $0x2,%edi
xor    %esi,%esi
call   1050 <SEND_REQDOWN_DELAYED@plt>
mov    $0x2,%edi
mov    $0x1,%esi
pop    %rax
jmp    1040 <SEND_DATAOFF_DELAYED@plt>
xor    %edi,%edi
xor    %esi,%esi
jmp    1030 <SEND_ACKDOWN_DELAYED@plt>
ret

LLVM IR (-O0):
%struct.comp = type { i32 }
%struct.BrzFetch_ = type { i32 }
define void @BrzFetch_ackdown(%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 %14 [
i32 1, label %9
i32 2, label %12
]
9: ; preds = %2
%10 = call i32 @SEND_REQDOWN_DELAYED(i32 2, i32 0)
%11 = call i32 @SEND_DATAOFF_DELAYED(i32 2, i32 1)
br label %14
12: ; preds = %2
%13 = call i32 @SEND_ACKDOWN_DELAYED(i32 0, i32 0)
br label %14
14: ; preds = %2, %12, %9
ret void
}

LLVM IR (-O2):
%struct.comp = type { i32 }
define void @BrzFetch_ackdown(%struct.comp* nocapture readnone %0, i32 %1) {
switch i32 %1, label %8 [
i32 1, label %3
i32 2, label %6
]
3: ; preds = %2
%4 = tail call i32 @SEND_REQDOWN_DELAYED(i32 2, i32 0)
%5 = tail call i32 @SEND_DATAOFF_DELAYED(i32 2, i32 1)
br label %8
6: ; preds = %2
%7 = tail call i32 @SEND_ACKDOWN_DELAYED(i32 0, i32 0)
br label %8
8: ; preds = %2, %6, %3
ret void
}