#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 atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ uwsgi_log(char *, char *);
void uwsgi_opt_set_int(char *opt, char *value, void *key) {
  int *ptr = (int *)key;
  if (value) {
    *ptr = atoi((char *)value);
  } else {
    *ptr = 1;
  }
  if (*ptr < 0) {
    uwsgi_log("invalid value for option \"%s\": must be > 0\n", opt);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<uwsgi_opt_set_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     116d <uwsgi_opt_set_int+0x3d>
mov    -0x10(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
jmp    1177 <uwsgi_opt_set_int+0x47>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x20(%rbp),%rax
cmpl   $0x0,(%rax)
jge    119e <uwsgi_opt_set_int+0x6e>
mov    -0x8(%rbp),%rsi
lea    0xe71(%rip),%rdi
call   1030 <uwsgi_log@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uwsgi_opt_set_int>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
test   %rsi,%rsi
je     1166 <uwsgi_opt_set_int+0x36>
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <atoi@plt>
mov    %eax,(%rbx)
test   %eax,%eax
jns    116c <uwsgi_opt_set_int+0x3c>
lea    0xeac(%rip),%rdi
mov    %r14,%rsi
call   1030 <uwsgi_log@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
movl   $0x1,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [44 x i8] c"invalid value for option \22%s\22: must be > 0\0A\00"
define void @uwsgi_opt_set_int(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %6
%9 = bitcast i8* %8 to i32*
store i32* %9, i32** %7
%10 = load i8*, i8** %5
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %16
12: ; preds = %3
%13 = load i8*, i8** %5
%14 = call i32 @atoi(i8* %13)
%15 = load i32*, i32** %7
store i32 %14, i32* %15
br label %18
16: ; preds = %3
%17 = load i32*, i32** %7
store i32 1, i32* %17
br label %18
18: ; preds = %16, %12
%19 = load i32*, i32** %7
%20 = load i32, i32* %19
%21 = icmp slt i32 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %18
%23 = load i8*, i8** %4
%24 = call i32 @uwsgi_log(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %23)
%25 = call i32 @exit(i32 1)
unreachable
26: ; preds = %18
ret void
}

LLVM IR (-O2):
@.str = [44 x i8] c"invalid value for option \22%s\22: must be > 0\0A\00"
define void @uwsgi_opt_set_int(i8* %0, i8* %1, i8* nocapture writeonly %2) {
%4 = bitcast i8* %2 to i32*
%5 = icmp eq i8* %1, null
br i1 %5, label %6, label %7
6: ; preds = %3
store i32 1, i32* %4
br label %13
7: ; preds = %3
%8 = tail call i32 @atoi(i8* %1)
store i32 %8, i32* %4
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = tail call i32 @uwsgi_log(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %0)
%12 = tail call i32 @exit(i32 1)
unreachable
13: ; preds = %6, %7
ret void
}