#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 */
scalar_t__ EINVAL;
scalar_t__ ERANGE;
unsigned long UINT_MAX;
scalar_t__ errno;
unsigned long strtoul(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ usage(int, char *);
unsigned int parse_backoff(char *s) {
  unsigned long l;
  errno = 0;
  l = strtoul(s, NULL, 0);
  if (errno == EINVAL || errno == ERANGE || l > UINT_MAX)
    usage(1, "backoff value out of range");
  return (unsigned int)l;
}


x86 assembly (clang, -O0):
<parse_backoff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e9d(%rip),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1040 <strtoul@plt>
mov    %rax,-0x10(%rbp)
mov    0x2e7c(%rip),%rax
mov    (%rax),%rax
mov    0x2e6a(%rip),%rcx
cmp    (%rcx),%rax
je     1195 <parse_backoff+0x75>
mov    0x2e62(%rip),%rax
mov    (%rax),%rax
mov    0x2e68(%rip),%rcx
cmp    (%rcx),%rax
je     1195 <parse_backoff+0x75>
mov    -0x10(%rbp),%rax
mov    0x2e5c(%rip),%rcx
cmp    (%rcx),%rax
jbe    11a6 <parse_backoff+0x86>
mov    $0x1,%edi
lea    0xe5f(%rip),%rsi
call   1030 <usage@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_backoff>:
push   %r14
push   %rbx
push   %rax
mov    0x2ea5(%rip),%r14
movq   $0x0,(%r14)
xor    %esi,%esi
xor    %edx,%edx
call   1040 <strtoul@plt>
mov    %rax,%rbx
mov    (%r14),%rax
mov    0x2e80(%rip),%rcx
cmp    (%rcx),%rax
je     1165 <parse_backoff+0x45>
mov    0x2e8c(%rip),%rcx
cmp    (%rcx),%rax
je     1165 <parse_backoff+0x45>
mov    0x2e88(%rip),%rax
cmp    (%rax),%rbx
jbe    1176 <parse_backoff+0x56>
lea    0xe94(%rip),%rsi
mov    $0x1,%edi
call   1030 <usage@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@errno = global i64 0
@EINVAL = global i64 0
@ERANGE = global i64 0
@UINT_MAX = global i64 0
@.str = [27 x i8] c"backoff value out of range\00"
define i32 @parse_backoff(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
store i64 0, i64* @errno
%4 = load i8*, i8** %2
%5 = call i64 @strtoul(i8* %4, i32* null, i32 0)
store i64 %5, i64* %3
%6 = load i64, i64* @errno
%7 = load i64, i64* @EINVAL
%8 = icmp eq i64 %6, %7
br i1 %8, label %17, label %9
9: ; preds = %1
%10 = load i64, i64* @errno
%11 = load i64, i64* @ERANGE
%12 = icmp eq i64 %10, %11
br i1 %12, label %17, label %13
13: ; preds = %9
%14 = load i64, i64* %3
%15 = load i64, i64* @UINT_MAX
%16 = icmp ugt i64 %14, %15
br i1 %16, label %17, label %19
17: ; preds = %13, %9, %1
%18 = call i32 @usage(i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %19
19: ; preds = %17, %13
%20 = load i64, i64* %3
%21 = trunc i64 %20 to i32
ret i32 %21
}

LLVM IR (-O2):
@errno = global i64 0
@EINVAL = global i64 0
@ERANGE = global i64 0
@UINT_MAX = global i64 0
@.str = [27 x i8] c"backoff value out of range\00"
define i32 @parse_backoff(i8* nocapture %0) {
store i64 0, i64* @errno
%2 = tail call i64 @strtoul(i8* nocapture %0, i32* null, i32 0)
%3 = load i64, i64* @errno
%4 = load i64, i64* @EINVAL
%5 = icmp eq i64 %3, %4
%6 = load i64, i64* @ERANGE
%7 = icmp eq i64 %3, %6
%8 = select i1 %5, i1 true, i1 %7
%9 = load i64, i64* @UINT_MAX
%10 = icmp ugt i64 %2, %9
%11 = select i1 %8, i1 true, i1 %10
br i1 %11, label %12, label %14
12: ; preds = %1
%13 = tail call i32 @usage(i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %1, %12
%15 = trunc i64 %2 to i32
ret i32 %15
}