#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*/ fmt2str(int, char *, int);
int /*<<< orphan*/ mp_msg_c(int, char *, int /*<<< orphan*/);
int check_format(int format) {
  char buf[256];
  switch (format & (7 << 3)) {
  case ((3 << 3)):
  case ((4 << 3)):
    mp_msg_c(((37) << 8) |
                 ((((-2) < 0) ? ((-2) + 3) : (((-2) == 0) ? 4 : ((-2) + 5)))),
             "[format] Sample format %s not yet supported \n",
             fmt2str(format, buf, 255));
    return -2;
  }
  return 1;
}


x86 assembly (clang, -O0):
<check_format>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x38,%eax
mov    %eax,-0x114(%rbp)
sub    $0x18,%eax
je     115c <check_format+0x3c>
jmp    1148 <check_format+0x28>
mov    -0x114(%rbp),%eax
sub    $0x20,%eax
jne    118f <check_format+0x6f>
jmp    115c <check_format+0x3c>
mov    -0x8(%rbp),%edi
lea    -0x110(%rbp),%rsi
mov    $0xff,%edx
call   1030 <fmt2str@plt>
mov    %eax,%edx
mov    $0x2501,%edi
lea    0xe82(%rip),%rsi
call   1040 <mp_msg_c@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    1196 <check_format+0x76>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_format>:
mov    %edi,%ecx
and    $0x38,%ecx
cmp    $0x20,%ecx
je     1134 <check_format+0x14>
mov    $0x1,%eax
cmp    $0x18,%ecx
jne    1167 <check_format+0x47>
sub    $0x108,%rsp
mov    %rsp,%rsi
mov    $0xff,%edx
call   1030 <fmt2str@plt>
lea    0xeb1(%rip),%rsi
mov    $0x2501,%edi
mov    %eax,%edx
call   1040 <mp_msg_c@plt>
mov    $0xfffffffe,%eax
add    $0x108,%rsp
ret

LLVM IR (-O0):
@.str = [46 x i8] c"[format] Sample format %s not yet supported \0A\00"
define i32 @check_format(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [256 x i8]
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = and i32 %5, 56
switch i32 %6, label %12 [
i32 24, label %7
i32 32, label %7
]
7: ; preds = %1, %1
%8 = load i32, i32* %3
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%10 = call i32 @fmt2str(i32 %8, i8* %9, i32 255)
%11 = call i32 @mp_msg_c(i32 9473, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 %10)
store i32 -2, i32* %2
br label %13
12: ; preds = %1
store i32 1, i32* %2
br label %13
13: ; preds = %12, %7
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@.str = [46 x i8] c"[format] Sample format %s not yet supported \0A\00"
define i32 @check_format(i32 %0) {
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%4 = and i32 %0, 56
switch i32 %4, label %8 [
i32 24, label %5
i32 32, label %5
]
5: ; preds = %1, %1
%6 = call i32 @fmt2str(i32 %0, i8* %3, i32 255)
%7 = call i32 @mp_msg_c(i32 9473, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %8
8: ; preds = %1, %5
%9 = phi i32 [ -2, %5 ], [ 1, %1 ]
ret i32 %9
}