#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ F_OK;
scalar_t__ access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void hda_power_on(void) {
  FILE *file;
  file = fopen("/sys/module/snd_hda_intel/parameters/power_save", "w");
  if (!file)
    return;
  fprintf(file, "1");
  fclose(file);
  if (access("/dev/dsp", F_OK))
    return;
  file = fopen("/dev/dsp", "w");
  if (file) {
    fprintf(file, "1");
    fclose(file);
  }
}


x86 assembly (clang, -O0):
<hda_power_on>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
lea    0xeda(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    116f <hda_power_on+0x2f>
jmp    11e7 <hda_power_on+0xa7>
mov    -0x8(%rbp),%rdi
lea    0xeb8(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
mov    0x2e49(%rip),%rax
mov    (%rax),%esi
lea    0xe9c(%rip),%rdi
call   1050 <access@plt>
cmp    $0x0,%rax
je     11ac <hda_power_on+0x6c>
jmp    11e7 <hda_power_on+0xa7>
lea    0xe81(%rip),%rdi
lea    0xe76(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     11e7 <hda_power_on+0xa7>
mov    -0x8(%rbp),%rdi
lea    0xe59(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hda_power_on>:
push   %rbx
lea    0xeb8(%rip),%rdi
lea    0xee1(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     118b <hda_power_on+0x4b>
mov    %rax,%rbx
mov    $0x31,%edi
mov    %rax,%rsi
call   1040 <fputc@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    0x2e60(%rip),%rax
mov    (%rax),%esi
lea    0xeb1(%rip),%rdi
call   1050 <access@plt>
test   %rax,%rax
je     118d <hda_power_on+0x4d>
pop    %rbx
ret
lea    0xe9e(%rip),%rdi
lea    0xe95(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     118b <hda_power_on+0x4b>
mov    %rax,%rbx
mov    $0x31,%edi
mov    %rax,%rsi
call   1040 <fputc@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [48 x i8] c"/sys/module/snd_hda_intel/parameters/power_save\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [2 x i8] c"1\00"
@.str.3 = [9 x i8] c"/dev/dsp\00"
@F_OK = global i32 0
define void @hda_power_on() {
%1 = alloca i32*
%2 = call i32* @fopen(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = icmp ne i32* %3, null
br i1 %4, label %6, label %5
5: ; preds = %0
br label %24
6: ; preds = %0
%7 = load i32*, i32** %1
%8 = call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%9 = load i32*, i32** %1
%10 = call i32 @fclose(i32* %9)
%11 = load i32, i32* @F_OK
%12 = call i64 @access(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %6
br label %24
15: ; preds = %6
%16 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %16, i32** %1
%17 = load i32*, i32** %1
%18 = icmp ne i32* %17, null
br i1 %18, label %19, label %24
19: ; preds = %15
%20 = load i32*, i32** %1
%21 = call i32 @fprintf(i32* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%22 = load i32*, i32** %1
%23 = call i32 @fclose(i32* %22)
br label %24
24: ; preds = %5, %14, %19, %15
ret void
}

LLVM IR (-O2):
@.str = [48 x i8] c"/sys/module/snd_hda_intel/parameters/power_save\00"
@.str.1 = [2 x i8] c"w\00"
@.str.3 = [9 x i8] c"/dev/dsp\00"
@F_OK = global i32 0
define void @hda_power_on() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32* %1, null
br i1 %2, label %15, label %3
3: ; preds = %0
%4 = tail call i32 @fputc(i32 49, i32* %1)
%5 = tail call i32 @fclose(i32* %1)
%6 = load i32, i32* @F_OK
%7 = tail call i64 @access(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %3
%10 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i32* %10, null
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = tail call i32 @fputc(i32 49, i32* %10)
%14 = tail call i32 @fclose(i32* %10)
br label %15
15: ; preds = %9, %12, %3, %0
ret void
}