#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 */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  scalar_t__ tv_nsec;
  scalar_t__ tv_sec;
};
struct TYPE_3__ {
  scalar_t__ tv_nsec;
  scalar_t__ tv_sec;
};
struct itimerspec {
  TYPE_2__ it_interval;
  TYPE_1__ it_value;
};

/* Variables and functions */
int timerfd_settime(int, int /*<<< orphan*/, struct itimerspec *,
                    int /*<<< orphan*/ *);
int ftimerfd_stop(int fd) {
  struct itimerspec new_value;
  new_value.it_value.tv_sec = 0;
  new_value.it_value.tv_nsec = 0;
  new_value.it_interval.tv_sec = 0;
  new_value.it_interval.tv_nsec = 0;
  if (timerfd_settime(fd, 0, &new_value, NULL) == -1)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<ftimerfd_stop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x8(%rbp),%edi
xor    %esi,%esi
lea    -0x28(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%ecx
call   1030 <timerfd_settime@plt>
cmp    $0xffffffff,%eax
jne    1162 <ftimerfd_stop+0x52>
movl   $0x1,-0x4(%rbp)
jmp    1169 <ftimerfd_stop+0x59>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ftimerfd_stop>:
sub    $0x28,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
mov    %rsp,%rdx
xor    %esi,%esi
xor    %ecx,%ecx
call   1030 <timerfd_settime@plt>
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
sete   %cl
mov    %ecx,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
%struct.itimerspec = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i64, i64 }
%struct.TYPE_3__ = type { i64, i64 }
define i32 @ftimerfd_stop(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.itimerspec
store i32 %0, i32* %3
%5 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %4, i32 0, i32 1
%6 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %5, i32 0, i32 1
store i64 0, i64* %6
%7 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %4, i32 0, i32 1
%8 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %7, i32 0, i32 0
store i64 0, i64* %8
%9 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %4, i32 0, i32 0
%10 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %9, i32 0, i32 1
store i64 0, i64* %10
%11 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %4, i32 0, i32 0
%12 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %11, i32 0, i32 0
store i64 0, i64* %12
%13 = load i32, i32* %3
%14 = call i32 @timerfd_settime(i32 %13, i32 0, %struct.itimerspec* %4, i32* null)
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %17
16: ; preds = %1
store i32 1, i32* %2
br label %18
17: ; preds = %1
store i32 0, i32* %2
br label %18
18: ; preds = %17, %16
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
%struct.itimerspec = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i64, i64 }
%struct.TYPE_3__ = type { i64, i64 }
define i32 @ftimerfd_stop(i32 %0) {
%2 = alloca %struct.itimerspec
%3 = bitcast %struct.itimerspec* %2 to i8*
%4 = bitcast %struct.itimerspec* %2 to i8*
%5 = call i32 @timerfd_settime(i32 %0, i32 0, %struct.itimerspec* %2, i32* null)
%6 = icmp eq i32 %5, -1
%7 = zext i1 %6 to i32
ret i32 %7
}