#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 max;
  scalar_t__ integer;
};

/* Variables and functions */
scalar_t__ param_is_interval(int);
struct snd_interval *param_to_interval(struct snd_pcm_hw_params *, int);
unsigned int param_get_int(struct snd_pcm_hw_params *p, int n) {
  if (param_is_interval(n)) {
    struct snd_interval *i = param_to_interval(p, n);
    if (i->integer)
      return i->max;
  }
  return 0;
}


x86 assembly (clang, -O0):
<param_get_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <param_is_interval@plt>
cmp    $0x0,%rax
je     1173 <param_get_int+0x53>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <param_to_interval@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     116e <param_get_int+0x4e>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    117a <param_get_int+0x5a>
jmp    1173 <param_get_int+0x53>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<param_get_int>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%r14
mov    %esi,%edi
call   1030 <param_is_interval@plt>
xor    %ebx,%ebx
test   %rax,%rax
je     114a <param_get_int+0x2a>
mov    %r14,%rdi
mov    %ebp,%esi
call   1040 <param_to_interval@plt>
cmpq   $0x0,0x8(%rax)
je     114a <param_get_int+0x2a>
mov    (%rax),%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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