#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_pcm_hw_params {
  unsigned int rmask;
  unsigned int info;
  scalar_t__ cmask;
};
struct snd_mask {
  int /*<<< orphan*/ *bits;
};
struct snd_interval {
  int /*<<< orphan*/ max;
  scalar_t__ min;
};

/* Variables and functions */
int SNDRV_PCM_HW_PARAM_FIRST_INTERVAL;
int SNDRV_PCM_HW_PARAM_FIRST_MASK;
int SNDRV_PCM_HW_PARAM_LAST_INTERVAL;
int SNDRV_PCM_HW_PARAM_LAST_MASK;
int /*<<< orphan*/ memset(struct snd_pcm_hw_params *, int /*<<< orphan*/, int);
struct snd_interval *param_to_interval(struct snd_pcm_hw_params *, int);
struct snd_mask *param_to_mask(struct snd_pcm_hw_params *, int);
void param_init(struct snd_pcm_hw_params *p) {
  int n;
  memset(p, 0, sizeof(*p));
  for (n = SNDRV_PCM_HW_PARAM_FIRST_MASK; n <= SNDRV_PCM_HW_PARAM_LAST_MASK;
       n++) {
    struct snd_mask *m = param_to_mask(p, n);
    m->bits[0] = ~0;
    m->bits[1] = ~0;
  }
  for (n = SNDRV_PCM_HW_PARAM_FIRST_INTERVAL;
       n <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL; n++) {
    struct snd_interval *i = param_to_interval(p, n);
    i->min = 0;
    i->max = ~0;
  }
  p->rmask = ~0U;
  p->cmask = 0;
  p->info = ~0U;
}


x86 assembly (clang, -O0):
<param_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1030 <memset@plt>
mov    0x2e7d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2e7e(%rip),%rcx
cmp    (%rcx),%eax
jg     11a3 <param_init+0x73>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <param_to_mask@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movl   $0xffffffff,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movl   $0xffffffff,0x4(%rax)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1158 <param_init+0x28>
mov    0x2e16(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2e2f(%rip),%rcx
cmp    (%rcx),%eax
jg     11f5 <param_init+0xc5>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1050 <param_to_interval@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movq   $0x0,0x8(%rax)
mov    -0x20(%rbp),%rax
movl   $0xffffffff,(%rax)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11af <param_init+0x7f>
mov    -0x8(%rbp),%rax
movl   $0xffffffff,(%rax)
mov    -0x8(%rbp),%rax
movq   $0x0,0x8(%rax)
mov    -0x8(%rbp),%rax
movl   $0xffffffff,0x4(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<param_init>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
xor    %esi,%esi
mov    $0x10,%edx
call   1030 <memset@plt>
mov    0x2e85(%rip),%rax
mov    (%rax),%ebx
mov    0x2e8c(%rip),%r15
cmp    (%r15),%ebx
jg     117e <param_init+0x4e>
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <param_to_mask@plt>
mov    (%rax),%rax
movq   $0xffffffffffffffff,(%rax)
lea    0x1(%rbx),%eax
cmp    (%r15),%ebx
mov    %eax,%ebx
jl     1160 <param_init+0x30>
mov    0x2e3b(%rip),%rax
mov    (%rax),%ebx
mov    0x2e5a(%rip),%r15
cmp    (%r15),%ebx
jg     11c2 <param_init+0x92>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %ebx,%esi
call   1050 <param_to_interval@plt>
movq   $0x0,0x8(%rax)
movl   $0xffffffff,(%rax)
lea    0x1(%rbx),%eax
cmp    (%r15),%ebx
mov    %eax,%ebx
jl     11a0 <param_init+0x70>
movq   $0xffffffffffffffff,(%r14)
movq   $0x0,0x8(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.snd_pcm_hw_params = type { i32, i32, i64 }
%struct.snd_mask = type { i32* }
%struct.snd_interval = type { i32, i64 }
@SNDRV_PCM_HW_PARAM_FIRST_MASK = global i32 0
@SNDRV_PCM_HW_PARAM_LAST_MASK = global i32 0
@SNDRV_PCM_HW_PARAM_FIRST_INTERVAL = global i32 0
@SNDRV_PCM_HW_PARAM_LAST_INTERVAL = global i32 0
define void @param_init(%struct.snd_pcm_hw_params* %0) {
%2 = alloca %struct.snd_pcm_hw_params*
%3 = alloca i32
%4 = alloca %struct.snd_mask*
%5 = alloca %struct.snd_interval*
store %struct.snd_pcm_hw_params* %0, %struct.snd_pcm_hw_params** %2
%6 = load %struct.snd_pcm_hw_params*, %struct.snd_pcm_hw_params** %2
%7 = call i32 @memset(%struct.snd_pcm_hw_params* %6, i32 0, i32 16)
%8 = load i32, i32* @SNDRV_PCM_HW_PARAM_FIRST_MASK
store i32 %8, i32* %3
br label %9
9: ; preds = %25, %1
%10 = load i32, i32* %3
%11 = load i32, i32* @SNDRV_PCM_HW_PARAM_LAST_MASK
%12 = icmp sle i32 %10, %11
br i1 %12, label %13, label %28
13: ; preds = %9
%14 = load %struct.snd_pcm_hw_params*, %struct.snd_pcm_hw_params** %2
%15 = load i32, i32* %3
%16 = call %struct.snd_mask* @param_to_mask(%struct.snd_pcm_hw_params* %14, i32 %15)
store %struct.snd_mask* %16, %struct.snd_mask** %4
%17 = load %struct.snd_mask*, %struct.snd_mask** %4
%18 = getelementptr inbounds %struct.snd_mask, %struct.snd_mask* %17, i32 0, i32 0
%19 = load i32*, i32** %18
%20 = getelementptr inbounds i32, i32* %19, i64 0
store i32 -1, i32* %20
%21 = load %struct.snd_mask*, %struct.snd_mask** %4
%22 = getelementptr inbounds %struct.snd_mask, %struct.snd_mask* %21, i32 0, i32 0
%23 = load i32*, i32** %22
%24 = getelementptr inbounds i32, i32* %23, i64 1
store i32 -1, i32* %24
br label %25
25: ; preds = %13
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 1
store i32 %27, i32* %3
br label %9
28: ; preds = %9
%29 = load i32, i32* @SNDRV_PCM_HW_PARAM_FIRST_INTERVAL
store i32 %29, i32* %3
br label %30
30: ; preds = %42, %28
%31 = load i32, i32* %3
%32 = load i32, i32* @SNDRV_PCM_HW_PARAM_LAST_INTERVAL
%33 = icmp sle i32 %31, %32
br i1 %33, label %34, label %45
34: ; preds = %30
%35 = load %struct.snd_pcm_hw_params*, %struct.snd_pcm_hw_params** %2
%36 = load i32, i32* %3
%37 = call %struct.snd_interval* @param_to_interval(%struct.snd_pcm_hw_params* %35, i32 %36)
store %struct.snd_interval* %37, %struct.snd_interval** %5
%38 = load %struct.snd_interval*, %struct.snd_interval** %5
%39 = getelementptr inbounds %struct.snd_interval, %struct.snd_interval* %38, i32 0, i32 1
store i64 0, i64* %39
%40 = load %struct.snd_interval*, %struct.snd_interval** %5
%41 = getelementptr inbounds %struct.snd_interval, %struct.snd_interval* %40, i32 0, i32 0
store i32 -1, i32* %41
br label %42
42: ; preds = %34
%43 = load i32, i32* %3
%44 = add nsw i32 %43, 1
store i32 %44, i32* %3
br label %30
45: ; preds = %30
%46 = load %struct.snd_pcm_hw_params*, %struct.snd_pcm_hw_params** %2
%47 = getelementptr inbounds %struct.snd_pcm_hw_params, %struct.snd_pcm_hw_params* %46, i32 0, i32 0
store i32 -1, i32* %47
%48 = load %struct.snd_pcm_hw_params*, %struct.snd_pcm_hw_params** %2
%49 = getelementptr inbounds %struct.snd_pcm_hw_params, %struct.snd_pcm_hw_params* %48, i32 0, i32 2
store i64 0, i64* %49
%50 = load %struct.snd_pcm_hw_params*, %struct.snd_pcm_hw_params** %2
%51 = getelementptr inbounds %struct.snd_pcm_hw_params, %struct.snd_pcm_hw_params* %50, i32 0, i32 1
store i32 -1, i32* %51
ret void
}

LLVM IR (-O2):
%struct.snd_pcm_hw_params = type { i32, i32, i64 }
%struct.snd_mask = type { i32* }
%struct.snd_interval = type { i32, i64 }
@SNDRV_PCM_HW_PARAM_FIRST_MASK = global i32 0
@SNDRV_PCM_HW_PARAM_LAST_MASK = global i32 0
@SNDRV_PCM_HW_PARAM_FIRST_INTERVAL = global i32 0
@SNDRV_PCM_HW_PARAM_LAST_INTERVAL = global i32 0
define void @param_init(%struct.snd_pcm_hw_params* %0) {
%2 = tail call i32 @memset(%struct.snd_pcm_hw_params* %0, i32 0, i32 16)
%3 = load i32, i32* @SNDRV_PCM_HW_PARAM_FIRST_MASK
%4 = load i32, i32* @SNDRV_PCM_HW_PARAM_LAST_MASK
%5 = icmp sgt i32 %3, %4
br i1 %5, label %15, label %6
6: ; preds = %1, %6
%7 = phi i32 [ %12, %6 ], [ %3, %1 ]
%8 = tail call %struct.snd_mask* @param_to_mask(%struct.snd_pcm_hw_params* %0, i32 %7)
%9 = getelementptr inbounds %struct.snd_mask, %struct.snd_mask* %8, i64 0, i32 0
%10 = load i32*, i32** %9
store i32 -1, i32* %10
%11 = getelementptr inbounds i32, i32* %10, i64 1
store i32 -1, i32* %11
%12 = add nsw i32 %7, 1
%13 = load i32, i32* @SNDRV_PCM_HW_PARAM_LAST_MASK
%14 = icmp slt i32 %7, %13
br i1 %14, label %6, label %15
15: ; preds = %6, %1
%16 = load i32, i32* @SNDRV_PCM_HW_PARAM_FIRST_INTERVAL
%17 = load i32, i32* @SNDRV_PCM_HW_PARAM_LAST_INTERVAL
%18 = icmp sgt i32 %16, %17
br i1 %18, label %27, label %19
19: ; preds = %15, %19
%20 = phi i32 [ %24, %19 ], [ %16, %15 ]
%21 = tail call %struct.snd_interval* @param_to_interval(%struct.snd_pcm_hw_params* %0, i32 %20)
%22 = getelementptr inbounds %struct.snd_interval, %struct.snd_interval* %21, i64 0, i32 1
store i64 0, i64* %22
%23 = getelementptr inbounds %struct.snd_interval, %struct.snd_interval* %21, i64 0, i32 0
store i32 -1, i32* %23
%24 = add nsw i32 %20, 1
%25 = load i32, i32* @SNDRV_PCM_HW_PARAM_LAST_INTERVAL
%26 = icmp slt i32 %20, %25
br i1 %26, label %19, label %27
27: ; preds = %19, %15
%28 = getelementptr inbounds %struct.snd_pcm_hw_params, %struct.snd_pcm_hw_params* %0, i64 0, i32 0
store i32 -1, i32* %28
%29 = getelementptr inbounds %struct.snd_pcm_hw_params, %struct.snd_pcm_hw_params* %0, i64 0, i32 2
store i64 0, i64* %29
%30 = getelementptr inbounds %struct.snd_pcm_hw_params, %struct.snd_pcm_hw_params* %0, i64 0, i32 1
store i32 -1, i32* %30
ret void
}