#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 alc850_is_aux_back_surround(struct snd_ac97 *);
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;
  int aux_is_back_surround;
  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));
  aux_is_back_surround = alc850_is_aux_back_surround(ac97);
  snd_ac97_update_bits(ac97, 0x6a, 1 << 10,
                       aux_is_back_surround ? (1 << 10) : (0 << 10));
}


x86 assembly (clang, -O0):
<alc850_update_jacks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <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   1050 <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>
mov    -0x8(%rbp),%rdi
call   1040 <alc850_is_aux_back_surround@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%edx
xor    %ecx,%ecx
mov    $0x400,%eax
cmp    $0x0,%edx
cmovne %eax,%ecx
mov    $0x6a,%esi
mov    $0x400,%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   1060 <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   1050 <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
call   1030 <snd_ac97_update_bits@plt>
mov    %rbx,%rdi
call   1040 <alc850_is_aux_back_surround@plt>
xor    %ecx,%ecx
test   %eax,%eax
setne  %cl
shl    $0xa,%ecx
mov    %rbx,%rdi
mov    $0x6a,%esi
mov    $0x400,%edx
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
%4 = alloca i32
store %struct.snd_ac97* %0, %struct.snd_ac97** %2
%5 = load %struct.snd_ac97*, %struct.snd_ac97** %2
%6 = call i32 @is_shared_surrout(%struct.snd_ac97* %5)
store i32 %6, i32* %3
%7 = load %struct.snd_ac97*, %struct.snd_ac97** %2
%8 = load i32, i32* %3
%9 = icmp ne i32 %8, 0
%10 = zext i1 %9 to i64
%11 = select i1 %9, i32 32, i32 16
%12 = call i32 @snd_ac97_update_bits(%struct.snd_ac97* %7, i32 122, i32 48, i32 %11)
%13 = load %struct.snd_ac97*, %struct.snd_ac97** %2
%14 = load i32, i32* %3
%15 = icmp ne i32 %14, 0
%16 = zext i1 %15 to i64
%17 = select i1 %15, i32 8192, i32 0
%18 = call i32 @snd_ac97_update_bits(%struct.snd_ac97* %13, i32 118, i32 28672, i32 %17)
%19 = load %struct.snd_ac97*, %struct.snd_ac97** %2
%20 = call i32 @is_shared_clfeout(%struct.snd_ac97* %19)
store i32 %20, i32* %3
%21 = load %struct.snd_ac97*, %struct.snd_ac97** %2
%22 = load i32, i32* %3
%23 = icmp ne i32 %22, 0
%24 = zext i1 %23 to i64
%25 = select i1 %23, i32 4096, i32 8192
%26 = call i32 @snd_ac97_update_bits(%struct.snd_ac97* %21, i32 122, i32 12288, i32 %25)
%27 = load %struct.snd_ac97*, %struct.snd_ac97** %2
%28 = load i32, i32* %3
%29 = icmp ne i32 %28, 0
%30 = zext i1 %29 to i64
%31 = select i1 %29, i32 80, i32 16
%32 = call i32 @snd_ac97_update_bits(%struct.snd_ac97* %27, i32 118, i32 112, i32 %31)
%33 = load %struct.snd_ac97*, %struct.snd_ac97** %2
%34 = call i32 @alc850_is_aux_back_surround(%struct.snd_ac97* %33)
store i32 %34, i32* %4
%35 = load %struct.snd_ac97*, %struct.snd_ac97** %2
%36 = load i32, i32* %4
%37 = icmp ne i32 %36, 0
%38 = zext i1 %37 to i64
%39 = select i1 %37, i32 1024, i32 0
%40 = call i32 @snd_ac97_update_bits(%struct.snd_ac97* %35, i32 106, i32 1024, i32 %39)
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)
%14 = tail call i32 @alc850_is_aux_back_surround(%struct.snd_ac97* %0)
%15 = icmp eq i32 %14, 0
%16 = select i1 %15, i32 0, i32 1024
%17 = tail call i32 @snd_ac97_update_bits(%struct.snd_ac97* %0, i32 106, i32 1024, i32 %16)
ret void
}