#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 */

/* Variables and functions */
int ece453_reg_read(char *);
int ece453_reg_write(char *, int);
int /*<<< orphan*/ pabort(char *);
void at42qt2120_deassert_reset(void) {
  int reg_val = ece453_reg_read("/sys/kernel/ece453/gpio_out");
  if (reg_val == -1)
    pabort(
        "at42qt2120.c::at42qt2120_deassert_reset: Unable to read GPIO_OUT_REG");
  reg_val |= (0x1 << 27);
  if (ece453_reg_write("/sys/kernel/ece453/gpio_out", reg_val) == -1)
    pabort("at42qt2120.c::at42qt2120_deassert_reset: Unable to write "
           "GPIO_OUT_REG");
}


x86 assembly (clang, -O0):
<at42qt2120_deassert_reset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <ece453_reg_read@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
jne    115d <at42qt2120_deassert_reset+0x2d>
lea    0xec4(%rip),%rdi
call   1050 <pabort@plt>
mov    -0x4(%rbp),%eax
or     $0x8000000,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xe8e(%rip),%rdi
call   1040 <ece453_reg_write@plt>
cmp    $0xffffffff,%eax
jne    118c <at42qt2120_deassert_reset+0x5c>
lea    0xeda(%rip),%rdi
call   1050 <pabort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<at42qt2120_deassert_reset>:
push   %rbx
lea    0xec8(%rip),%rdi
call   1030 <ece453_reg_read@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    1150 <at42qt2120_deassert_reset+0x20>
lea    0xed1(%rip),%rdi
call   1050 <pabort@plt>
or     $0x8000000,%ebx
lea    0xea3(%rip),%rdi
mov    %ebx,%esi
call   1040 <ece453_reg_write@plt>
cmp    $0xffffffff,%eax
je     116b <at42qt2120_deassert_reset+0x3b>
pop    %rbx
ret
lea    0xeef(%rip),%rdi
pop    %rbx
jmp    1050 <pabort@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"/sys/kernel/ece453/gpio_out\00"
@.str.1 = [69 x i8] c"at42qt2120.c::at42qt2120_deassert_reset: Unable to read GPIO_OUT_REG\00"
@.str.2 = [70 x i8] c"at42qt2120.c::at42qt2120_deassert_reset: Unable to write GPIO_OUT_REG\00"
define void @at42qt2120_deassert_reset() {
%1 = alloca i32
%2 = call i32 @ece453_reg_read(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @pabort(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.1, i64 0, i64 0))
br label %7
7: ; preds = %5, %0
%8 = load i32, i32* %1
%9 = or i32 %8, 134217728
store i32 %9, i32* %1
%10 = load i32, i32* %1
%11 = call i32 @ece453_reg_write(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %15
13: ; preds = %7
%14 = call i32 @pabort(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %13, %7
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"/sys/kernel/ece453/gpio_out\00"
@.str.1 = [69 x i8] c"at42qt2120.c::at42qt2120_deassert_reset: Unable to read GPIO_OUT_REG\00"
@.str.2 = [70 x i8] c"at42qt2120.c::at42qt2120_deassert_reset: Unable to write GPIO_OUT_REG\00"
define void @at42qt2120_deassert_reset() {
%1 = tail call i32 @ece453_reg_read(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, -1
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @pabort(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.1, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
%6 = or i32 %1, 134217728
%7 = tail call i32 @ece453_reg_write(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = tail call i32 @pabort(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.2, i64 0, i64 0))
br label %11
11: ; preds = %9, %5
ret void
}