#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 EINVAL;
int /*<<< orphan*/ assert(void *);
int atoi(char const *);
int /*<<< orphan*/ is_number(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char const *);
int config_parse_int(const char *filename, unsigned line, const char *section,
                     const char *lvalue, int ltype, const char *rvalue,
                     void *data) {
  int *i = data;
  assert(filename);
  assert(lvalue);
  assert(rvalue);
  assert(data);
  if (!is_number(rvalue, strlen(rvalue)))
    return -EINVAL;
  *i = atoi(rvalue);
  return 0;
}


x86 assembly (clang, -O0):
<config_parse_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
mov    %r9,-0x38(%rbp)
mov    0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <assert@plt>
mov    -0x28(%rbp),%rdi
call   1050 <assert@plt>
mov    -0x38(%rbp),%rdi
call   1050 <assert@plt>
mov    0x10(%rbp),%rdi
call   1050 <assert@plt>
mov    -0x38(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x38(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x48(%rbp),%rdi
mov    %eax,%esi
call   1030 <is_number@plt>
cmp    $0x0,%eax
jne    11c7 <config_parse_int+0x87>
xor    %eax,%eax
mov    0x2e23(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    11df <config_parse_int+0x9f>
mov    -0x38(%rbp),%rdi
call   1060 <atoi@plt>
mov    %eax,%ecx
mov    -0x40(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<config_parse_int>:
push   %r15
push   %r14
push   %rbx
mov    %r9,%rbx
mov    %rcx,%r15
mov    0x20(%rsp),%r14
call   1050 <assert@plt>
mov    %r15,%rdi
call   1050 <assert@plt>
mov    %rbx,%rdi
call   1050 <assert@plt>
mov    %r14,%rdi
call   1050 <assert@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <is_number@plt>
test   %eax,%eax
je     1192 <config_parse_int+0x52>
mov    %rbx,%rdi
call   1060 <atoi@plt>
mov    %eax,(%r14)
xor    %eax,%eax
jmp    119d <config_parse_int+0x5d>
mov    0x2e47(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @config_parse_int(i8* %0, i32 %1, i8* %2, i8* %3, i32 %4, i8* %5, i8* %6) {
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i32*
store i8* %0, i8** %9
store i32 %1, i32* %10
store i8* %2, i8** %11
store i8* %3, i8** %12
store i32 %4, i32* %13
store i8* %5, i8** %14
store i8* %6, i8** %15
%17 = load i8*, i8** %15
%18 = bitcast i8* %17 to i32*
store i32* %18, i32** %16
%19 = load i8*, i8** %9
%20 = call i32 @assert(i8* %19)
%21 = load i8*, i8** %12
%22 = call i32 @assert(i8* %21)
%23 = load i8*, i8** %14
%24 = call i32 @assert(i8* %23)
%25 = load i8*, i8** %15
%26 = call i32 @assert(i8* %25)
%27 = load i8*, i8** %14
%28 = load i8*, i8** %14
%29 = call i32 @strlen(i8* %28)
%30 = call i32 @is_number(i8* %27, i32 %29)
%31 = icmp ne i32 %30, 0
br i1 %31, label %35, label %32
32: ; preds = %7
%33 = load i32, i32* @EINVAL
%34 = sub nsw i32 0, %33
store i32 %34, i32* %8
br label %39
35: ; preds = %7
%36 = load i8*, i8** %14
%37 = call i32 @atoi(i8* %36)
%38 = load i32*, i32** %16
store i32 %37, i32* %38
store i32 0, i32* %8
br label %39
39: ; preds = %35, %32
%40 = load i32, i32* %8
ret i32 %40
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @config_parse_int(i8* %0, i32 %1, i8* nocapture readnone %2, i8* %3, i32 %4, i8* %5, i8* %6) {
%8 = tail call i32 @assert(i8* %0)
%9 = tail call i32 @assert(i8* %3)
%10 = tail call i32 @assert(i8* %5)
%11 = tail call i32 @assert(i8* %6)
%12 = tail call i32 @strlen(i8* %5)
%13 = tail call i32 @is_number(i8* %5, i32 %12)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %7
%16 = load i32, i32* @EINVAL
%17 = sub nsw i32 0, %16
br label %21
18: ; preds = %7
%19 = bitcast i8* %6 to i32*
%20 = tail call i32 @atoi(i8* %5)
store i32 %20, i32* %19
br label %21
21: ; preds = %18, %15
%22 = phi i32 [ 0, %18 ], [ %17, %15 ]
ret i32 %22
}