#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 snd_codec {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int is_codec_supported(unsigned int, unsigned int, int, struct snd_codec *);
int /*<<< orphan*/ stderr;
int check_codec_format_supported(unsigned int card, unsigned int device,
                                 struct snd_codec *codec) {
  if (is_codec_supported(card, device, 0x10000000, codec) == false) {
    fprintf(stderr, "Error: This codec or format is not supported by DSP\n");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<check_codec_format_supported>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rcx
mov    $0x10000000,%edx
call   1040 <is_codec_supported@plt>
cmp    $0x0,%eax
jne    1170 <check_codec_format_supported+0x50>
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
lea    0xea1(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1177 <check_codec_format_supported+0x57>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_codec_format_supported>:
push   %rax
mov    %rdx,%rcx
mov    $0x10000000,%edx
call   1040 <is_codec_supported@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
je     1138 <check_codec_format_supported+0x18>
pop    %rcx
ret
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
lea    0xeb8(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.snd_codec = type { i32 }
@stderr = global i32 0
@.str = [53 x i8] c"Error: This codec or format is not supported by DSP\0A\00"
define i32 @check_codec_format_supported(i32 %0, i32 %1, %struct.snd_codec* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca %struct.snd_codec*
store i32 %0, i32* %5
store i32 %1, i32* %6
store %struct.snd_codec* %2, %struct.snd_codec** %7
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = load %struct.snd_codec*, %struct.snd_codec** %7
%11 = call i32 @is_codec_supported(i32 %8, i32 %9, i32 268435456, %struct.snd_codec* %10)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %3
%14 = load i32, i32* @stderr
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %4
br label %17
16: ; preds = %3
store i32 0, i32* %4
br label %17
17: ; preds = %16, %13
%18 = load i32, i32* %4
ret i32 %18
}

LLVM IR (-O2):
%struct.snd_codec = type { i32 }
@stderr = global i32 0
@.str = [53 x i8] c"Error: This codec or format is not supported by DSP\0A\00"
define i32 @check_codec_format_supported(i32 %0, i32 %1, %struct.snd_codec* %2) {
%4 = tail call i32 @is_codec_supported(i32 %0, i32 %1, i32 268435456, %struct.snd_codec* %2)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %3, %6
%10 = phi i32 [ -1, %6 ], [ 0, %3 ]
ret i32 %10
}