#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 */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ memset(int /*<<< orphan*/ *, int /*<<< orphan*/, int);
void tc_format_mute(uint8_t *buf, int buflen, int format) {
  switch (format) {
  case 0x1:
    memset(buf + 0, 0, buflen - 0);
    break;
  case 0x55:
    memset(buf + 4, 0, buflen - 4);
    break;
  case 0x2000:
    memset(buf + 5, 0, buflen - 5);
    break;
  default:
    break;
  }
}


x86 assembly (clang, -O0):
<tc_format_mute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x1,%eax
je     115a <tc_format_mute+0x4a>
jmp    1136 <tc_format_mute+0x26>
mov    -0x14(%rbp),%eax
sub    $0x55,%eax
je     1170 <tc_format_mute+0x60>
jmp    1147 <tc_format_mute+0x37>
mov    -0x14(%rbp),%eax
sub    $0x2000,%eax
je     118a <tc_format_mute+0x7a>
jmp    11a4 <tc_format_mute+0x94>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
sub    $0x0,%edx
xor    %esi,%esi
call   1030 <memset@plt>
jmp    11a9 <tc_format_mute+0x99>
mov    -0x8(%rbp),%rdi
add    $0x10,%rdi
mov    -0xc(%rbp),%edx
sub    $0x4,%edx
xor    %esi,%esi
call   1030 <memset@plt>
jmp    11a9 <tc_format_mute+0x99>
mov    -0x8(%rbp),%rdi
add    $0x14,%rdi
mov    -0xc(%rbp),%edx
sub    $0x5,%edx
xor    %esi,%esi
call   1030 <memset@plt>
jmp    11a9 <tc_format_mute+0x99>
jmp    11a9 <tc_format_mute+0x99>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tc_format_mute>:
mov    %esi,%eax
cmp    $0x2000,%edx
je     1125 <tc_format_mute+0x15>
cmp    $0x55,%edx
je     112e <tc_format_mute+0x1e>
cmp    $0x1,%edx
je     1135 <tc_format_mute+0x25>
ret
add    $0x14,%rdi
add    $0xfffffffb,%eax
jmp    1135 <tc_format_mute+0x25>
add    $0x10,%rdi
add    $0xfffffffc,%eax
xor    %esi,%esi
mov    %eax,%edx
jmp    1030 <memset@plt>

LLVM IR (-O0):
define void @tc_format_mute(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
switch i32 %7, label %26 [
i32 1, label %8
i32 85, label %14
i32 8192, label %20
]
8: ; preds = %3
%9 = load i32*, i32** %4
%10 = getelementptr inbounds i32, i32* %9, i64 0
%11 = load i32, i32* %5
%12 = sub nsw i32 %11, 0
%13 = call i32 @memset(i32* %10, i32 0, i32 %12)
br label %27
14: ; preds = %3
%15 = load i32*, i32** %4
%16 = getelementptr inbounds i32, i32* %15, i64 4
%17 = load i32, i32* %5
%18 = sub nsw i32 %17, 4
%19 = call i32 @memset(i32* %16, i32 0, i32 %18)
br label %27
20: ; preds = %3
%21 = load i32*, i32** %4
%22 = getelementptr inbounds i32, i32* %21, i64 5
%23 = load i32, i32* %5
%24 = sub nsw i32 %23, 5
%25 = call i32 @memset(i32* %22, i32 0, i32 %24)
br label %27
26: ; preds = %3
br label %27
27: ; preds = %26, %20, %14, %8
ret void
}

LLVM IR (-O2):
define void @tc_format_mute(i32* %0, i32 %1, i32 %2) {
switch i32 %2, label %14 [
i32 1, label %4
i32 85, label %6
i32 8192, label %10
]
4: ; preds = %3
%5 = tail call i32 @memset(i32* %0, i32 0, i32 %1)
br label %14
6: ; preds = %3
%7 = getelementptr inbounds i32, i32* %0, i64 4
%8 = add nsw i32 %1, -4
%9 = tail call i32 @memset(i32* %7, i32 0, i32 %8)
br label %14
10: ; preds = %3
%11 = getelementptr inbounds i32, i32* %0, i64 5
%12 = add nsw i32 %1, -5
%13 = tail call i32 @memset(i32* %11, i32 0, i32 %12)
br label %14
14: ; preds = %3, %10, %6, %4
ret void
}