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

/* Variables and functions */
int is_shared_clfeout(struct snd_ac97 *);
int is_shared_surrout(struct snd_ac97 *);
int /*<<< orphan*/ snd_ac97_update_bits(struct snd_ac97 *, int, int, int);
void alc850_update_jacks(struct snd_ac97 *ac97) {
  int shared;
  shared = is_shared_surrout(ac97);
  snd_ac97_update_bits(ac97, 0x7a, (1 << 4) | (1 << 5),
                       shared ? (1 << 5) : (1 << 4));
  snd_ac97_update_bits(ac97, 0x76, 7 << 12, shared ? (2 << 12) : (0 << 12));
  shared = is_shared_clfeout(ac97);
  snd_ac97_update_bits(ac97, 0x7a, (1 << 12) | (1 << 13),
                       shared ? (1 << 12) : (1 << 13));
  snd_ac97_update_bits(ac97, 0x76, 7 << 4, shared ? (5 << 4) : (1 << 4));
}


x86 assembly (clang, -O0):
<alc850_update_jacks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <is_shared_surrout@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    $0x10,%ecx
mov    $0x20,%eax
cmp    $0x0,%edx
cmovne %eax,%ecx
mov    $0x7a,%esi
mov    $0x30,%edx
call   1030 <snd_ac97_update_bits@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
xor    %ecx,%ecx
mov    $0x2000,%eax
cmp    $0x0,%edx
cmovne %eax,%ecx
mov    $0x76,%esi
mov    $0x7000,%edx
call   1030 <snd_ac97_update_bits@plt>
mov    -0x8(%rbp),%rdi
call   1040 <is_shared_clfeout@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    $0x2000,%ecx
mov    $0x1000,%eax
cmp    $0x0,%edx
cmovne %eax,%ecx
mov    $0x7a,%esi
mov    $0x3000,%edx
call   1030 <snd_ac97_update_bits@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    $0x10,%ecx
mov    $0x50,%eax
cmp    $0x0,%edx
cmovne %eax,%ecx
mov    $0x76,%esi
mov    $0x70,%edx
call   1030 <snd_ac97_update_bits@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alc850_update_jacks>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1050 <is_shared_surrout@plt>
xor    %ebp,%ebp
test   %eax,%eax
setne  %bpl
mov    %ebp,%ecx
shl    $0x4,%ecx
add    $0x10,%ecx
mov    %rbx,%rdi
mov    $0x7a,%esi
mov    $0x30,%edx
call   1030 <snd_ac97_update_bits@plt>
shl    $0xd,%ebp
mov    %rbx,%rdi
mov    $0x76,%esi
mov    $0x7000,%edx
mov    %ebp,%ecx
call   1030 <snd_ac97_update_bits@plt>
mov    %rbx,%rdi
call   1040 <is_shared_clfeout@plt>
xor    %ebp,%ebp
xor    %ecx,%ecx
test   %eax,%eax
setne  %bpl
sete   %cl
shl    $0xc,%ecx
add    $0x1000,%ecx
mov    %rbx,%rdi
mov    $0x7a,%esi
mov    $0x3000,%edx
call   1030 <snd_ac97_update_bits@plt>
shl    $0x6,%ebp
or     $0x10,%ebp
mov    %rbx,%rdi
mov    $0x76,%esi
mov    $0x70,%edx
mov    %ebp,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <snd_ac97_update_bits@plt>

LLVM IR (-O0):
%struct.snd_ac97 = type { i32 }
define void @alc850_update_jacks(%struct.snd_ac97* %0) {
%2 = alloca %struct.snd_ac97*
%3 = alloca i32
store %struct.snd_ac97* %0, %struct.snd_ac97** %2
%4 = load %struct.snd_ac97*, %struct.snd_ac97** %2
%5 = call i32 @is_shared_surrout(%struct.snd_ac97* %4)
store i32 %5, i32* %3
%6 = load %struct.snd_ac97*, %struct.snd_ac97** %2
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 0
%9 = zext i1 %8 to i64
%10 = select i1 %8, i32 32, i32 16
%11 = call i32 @snd_ac97_update_bits(%struct.snd_ac97* %6, i32 122, i32 48, i32 %10)
%12 = load %struct.snd_ac97*, %struct.snd_ac97** %2
%13 = load i32, i32* %3
%14 = icmp ne i32 %13, 0
%15 = zext i1 %14 to i64
%16 = select i1 %14, i32 8192, i32 0
%17 = call i32 @snd_ac97_update_bits(%struct.snd_ac97* %12, i32 118, i32 28672, i32 %16)
%18 = load %struct.snd_ac97*, %struct.snd_ac97** %2
%19 = call i32 @is_shared_clfeout(%struct.snd_ac97* %18)
store i32 %19, i32* %3
%20 = load %struct.snd_ac97*, %struct.snd_ac97** %2
%21 = load i32, i32* %3
%22 = icmp ne i32 %21, 0
%23 = zext i1 %22 to i64
%24 = select i1 %22, i32 4096, i32 8192
%25 = call i32 @snd_ac97_update_bits(%struct.snd_ac97* %20, i32 122, i32 12288, i32 %24)
%26 = load %struct.snd_ac97*, %struct.snd_ac97** %2
%27 = load i32, i32* %3
%28 = icmp ne i32 %27, 0
%29 = zext i1 %28 to i64
%30 = select i1 %28, i32 80, i32 16
%31 = call i32 @snd_ac97_update_bits(%struct.snd_ac97* %26, i32 118, i32 112, i32 %30)
ret void
}

LLVM IR (-O2):
%struct.snd_ac97 = type { i32 }
define void @alc850_update_jacks(%struct.snd_ac97* %0) {
%2 = tail call i32 @is_shared_surrout(%struct.snd_ac97* %0)
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 16, i32 32
%5 = tail call i32 @snd_ac97_update_bits(%struct.snd_ac97* %0, i32 122, i32 48, i32 %4)
%6 = select i1 %3, i32 0, i32 8192
%7 = tail call i32 @snd_ac97_update_bits(%struct.snd_ac97* %0, i32 118, i32 28672, i32 %6)
%8 = tail call i32 @is_shared_clfeout(%struct.snd_ac97* %0)
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i32 8192, i32 4096
%11 = tail call i32 @snd_ac97_update_bits(%struct.snd_ac97* %0, i32 122, i32 12288, i32 %10)
%12 = select i1 %9, i32 16, i32 80
%13 = tail call i32 @snd_ac97_update_bits(%struct.snd_ac97* %0, i32 118, i32 112, i32 %12)
ret void
}