#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__ ERANGE;
scalar_t__ errno;
int fail_invalid(int *);
int strlen(char const *);
int parse_status(const char *optarg, const char *end, int *cont) {
  if (optarg == end || errno == ERANGE || end != optarg + strlen(optarg)) {
    return fail_invalid(cont);
  }
  return 0;
}


x86 assembly (clang, -O0):
<parse_status>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
je     118e <parse_status+0x6e>
mov    0x2e8f(%rip),%rax
mov    (%rax),%rax
mov    0x2e95(%rip),%rcx
cmp    (%rcx),%rax
je     118e <parse_status+0x6e>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x30(%rbp),%rcx
mov    %eax,%edx
mov    -0x28(%rbp),%rax
movslq %edx,%rdx
add    %rdx,%rcx
cmp    %rcx,%rax
je     119f <parse_status+0x7f>
mov    -0x20(%rbp),%rdi
call   1040 <fail_invalid@plt>
mov    %eax,-0x4(%rbp)
jmp    11a6 <parse_status+0x86>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_status>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
cmp    %rsi,%rdi
je     1158 <parse_status+0x38>
mov    0x2ea4(%rip),%rax
mov    (%rax),%rax
mov    0x2eaa(%rip),%rcx
cmp    (%rcx),%rax
je     1158 <parse_status+0x38>
mov    %rsi,%r15
mov    %rdi,%rbx
call   1030 <strlen@plt>
cltq
add    %rbx,%rax
cmp    %r15,%rax
je     1165 <parse_status+0x45>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <fail_invalid@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@errno = global i64 0
@ERANGE = global i64 0
define i32 @parse_status(i8* %0, i8* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32* %2, i32** %7
%8 = load i8*, i8** %5
%9 = load i8*, i8** %6
%10 = icmp eq i8* %8, %9
br i1 %10, label %23, label %11
11: ; preds = %3
%12 = load i64, i64* @errno
%13 = load i64, i64* @ERANGE
%14 = icmp eq i64 %12, %13
br i1 %14, label %23, label %15
15: ; preds = %11
%16 = load i8*, i8** %6
%17 = load i8*, i8** %5
%18 = load i8*, i8** %5
%19 = call i32 @strlen(i8* %18)
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %17, i64 %20
%22 = icmp ne i8* %16, %21
br i1 %22, label %23, label %26
23: ; preds = %15, %11, %3
%24 = load i32*, i32** %7
%25 = call i32 @fail_invalid(i32* %24)
store i32 %25, i32* %4
br label %27
26: ; preds = %15
store i32 0, i32* %4
br label %27
27: ; preds = %26, %23
%28 = load i32, i32* %4
ret i32 %28
}

LLVM IR (-O2):
@errno = global i64 0
@ERANGE = global i64 0
define i32 @parse_status(i8* %0, i8* readnone %1, i32* %2) {
%4 = icmp eq i8* %0, %1
br i1 %4, label %14, label %5
5: ; preds = %3
%6 = load i64, i64* @errno
%7 = load i64, i64* @ERANGE
%8 = icmp eq i64 %6, %7
br i1 %8, label %14, label %9
9: ; preds = %5
%10 = tail call i32 @strlen(i8* %0)
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = icmp eq i8* %12, %1
br i1 %13, label %16, label %14
14: ; preds = %9, %5, %3
%15 = tail call i32 @fail_invalid(i32* %2)
br label %16
16: ; preds = %9, %14
%17 = phi i32 [ %15, %14 ], [ 0, %9 ]
ret i32 %17
}