#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;
};

/* 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_max(struct snd_pcm_hw_params *p, int n) {
  if (param_is_interval(n)) {
    struct snd_interval *i = param_to_interval(p, n);
    return i->max;
  }
  return 0;
}


x86 assembly (clang, -O0):
<param_get_max>:
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     115f <param_get_max+0x3f>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <param_to_interval@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1166 <param_get_max+0x46>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<param_get_max>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
mov    %esi,%edi
call   1030 <param_is_interval@plt>
test   %rax,%rax
je     1143 <param_get_max+0x23>
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <param_to_interval@plt>
mov    (%rax),%eax
jmp    1145 <param_get_max+0x25>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.snd_pcm_hw_params = type { i32 }
%struct.snd_interval = type { i32 }
define i32 @param_get_max(%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 %17
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 0
%16 = load i32, i32* %15
store i32 %16, i32* %3
br label %18
17: ; preds = %2
store i32 0, i32* %3
br label %18
18: ; preds = %17, %10
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
%struct.snd_pcm_hw_params = type { i32 }
%struct.snd_interval = type { i32 }
define i32 @param_get_max(%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 %9, 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 0
%8 = load i32, i32* %7
br label %9
9: ; preds = %2, %5
%10 = phi i32 [ %8, %5 ], [ 0, %2 ]
ret i32 %10
}