#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 {
  int dummy;
};
struct snd_interval {
  unsigned int min;
  unsigned int max;
  int integer;
};

/* Variables and functions */
scalar_t__ param_is_interval(int);
struct snd_interval *param_to_interval(struct snd_pcm_hw_params *, int);
void param_set_int(struct snd_pcm_hw_params *p, int n, unsigned int val) {
  if (param_is_interval(n)) {
    struct snd_interval *i = param_to_interval(p, n);
    i->min = val;
    i->max = val;
    i->integer = 1;
  }
}


x86 assembly (clang, -O0):
<param_set_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <param_is_interval@plt>
cmp    $0x0,%rax
je     1172 <param_set_int+0x52>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <param_to_interval@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x18(%rbp),%rax
movl   $0x1,0x8(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<param_set_int>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%ebp
mov    %rdi,%r14
mov    %esi,%edi
call   1030 <param_is_interval@plt>
test   %rax,%rax
je     114d <param_set_int+0x2d>
mov    %r14,%rdi
mov    %ebp,%esi
call   1040 <param_to_interval@plt>
mov    %ebx,(%rax)
mov    %ebx,0x4(%rax)
movl   $0x1,0x8(%rax)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.snd_pcm_hw_params = type { i32 }
%struct.snd_interval = type { i32, i32, i32 }
define void @param_set_int(%struct.snd_pcm_hw_params* %0, i32 %1, i32 %2) {
%4 = alloca %struct.snd_pcm_hw_params*
%5 = alloca i32
%6 = alloca i32
%7 = alloca %struct.snd_interval*
store %struct.snd_pcm_hw_params* %0, %struct.snd_pcm_hw_params** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
%9 = call i64 @param_is_interval(i32 %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %23
11: ; preds = %3
%12 = load %struct.snd_pcm_hw_params*, %struct.snd_pcm_hw_params** %4
%13 = load i32, i32* %5
%14 = call %struct.snd_interval* @param_to_interval(%struct.snd_pcm_hw_params* %12, i32 %13)
store %struct.snd_interval* %14, %struct.snd_interval** %7
%15 = load i32, i32* %6
%16 = load %struct.snd_interval*, %struct.snd_interval** %7
%17 = getelementptr inbounds %struct.snd_interval, %struct.snd_interval* %16, i32 0, i32 0
store i32 %15, i32* %17
%18 = load i32, i32* %6
%19 = load %struct.snd_interval*, %struct.snd_interval** %7
%20 = getelementptr inbounds %struct.snd_interval, %struct.snd_interval* %19, i32 0, i32 1
store i32 %18, i32* %20
%21 = load %struct.snd_interval*, %struct.snd_interval** %7
%22 = getelementptr inbounds %struct.snd_interval, %struct.snd_interval* %21, i32 0, i32 2
store i32 1, i32* %22
br label %23
23: ; preds = %11, %3
ret void
}

LLVM IR (-O2):
%struct.snd_pcm_hw_params = type { i32 }
%struct.snd_interval = type { i32, i32, i32 }
define void @param_set_int(%struct.snd_pcm_hw_params* %0, i32 %1, i32 %2) {
%4 = tail call i64 @param_is_interval(i32 %1)
%5 = icmp eq i64 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %3
%7 = tail call %struct.snd_interval* @param_to_interval(%struct.snd_pcm_hw_params* %0, i32 %1)
%8 = getelementptr inbounds %struct.snd_interval, %struct.snd_interval* %7, i64 0, i32 0
store i32 %2, i32* %8
%9 = getelementptr inbounds %struct.snd_interval, %struct.snd_interval* %7, i64 0, i32 1
store i32 %2, i32* %9
%10 = getelementptr inbounds %struct.snd_interval, %struct.snd_interval* %7, i64 0, i32 2
store i32 1, i32* %10
br label %11
11: ; preds = %6, %3
ret void
}