#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 */
char *om_gsm_flowcontrol_path();
scalar_t__ om_sysfs_writefile(char const *, char *);
int om_gsm_flowcontrol_set(int value) {
  const char *flowcontrol_path = om_gsm_flowcontrol_path();
  if (flowcontrol_path == NULL)
    return -1;
  if (om_sysfs_writefile(flowcontrol_path, value ? "1\n" : "0\n") < 0)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<om_gsm_flowcontrol_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <om_gsm_flowcontrol_path@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114d <om_gsm_flowcontrol_set+0x2d>
movl   $0xffffffff,-0x4(%rbp)
jmp    118b <om_gsm_flowcontrol_set+0x6b>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%ecx
lea    0xea8(%rip),%rsi
lea    0xe9e(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
call   1040 <om_sysfs_writefile@plt>
cmp    $0x0,%rax
jge    1184 <om_gsm_flowcontrol_set+0x64>
movl   $0xffffffff,-0x4(%rbp)
jmp    118b <om_gsm_flowcontrol_set+0x6b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<om_gsm_flowcontrol_set>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <om_gsm_flowcontrol_path@plt>
test   %rax,%rax
je     1151 <om_gsm_flowcontrol_set+0x31>
test   %ebx,%ebx
lea    0xecb(%rip),%rcx
lea    0xec1(%rip),%rsi
cmove  %rcx,%rsi
mov    %rax,%rdi
call   1040 <om_sysfs_writefile@plt>
sar    $0x3f,%rax
pop    %rbx
ret
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"1\0A\00"
@.str.1 = [3 x i8] c"0\0A\00"
define i32 @om_gsm_flowcontrol_set(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
%5 = call i8* (...) @om_gsm_flowcontrol_path()
store i8* %5, i8** %4
%6 = load i8*, i8** %4
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 -1, i32* %2
br label %19
9: ; preds = %1
%10 = load i8*, i8** %4
%11 = load i32, i32* %3
%12 = icmp ne i32 %11, 0
%13 = zext i1 %12 to i64
%14 = select i1 %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0)
%15 = call i64 @om_sysfs_writefile(i8* %10, i8* %14)
%16 = icmp slt i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %9
store i32 -1, i32* %2
br label %19
18: ; preds = %9
store i32 0, i32* %2
br label %19
19: ; preds = %18, %17, %8
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
@.str = [3 x i8] c"1\0A\00"
@.str.1 = [3 x i8] c"0\0A\00"
define i32 @om_gsm_flowcontrol_set(i32 %0) {
%2 = tail call i8* (...) @om_gsm_flowcontrol_path()
%3 = icmp eq i8* %2, null
br i1 %3, label %10, label %4
4: ; preds = %1
%5 = icmp eq i32 %0, 0
%6 = select i1 %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0)
%7 = tail call i64 @om_sysfs_writefile(i8* %2, i8* %6)
%8 = ashr i64 %7, 63
%9 = trunc i64 %8 to i32
br label %10
10: ; preds = %4, %1
%11 = phi i32 [ -1, %1 ], [ %9, %4 ]
ret i32 %11
}