#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 UINT_MAX;
int atoi(char *);
int strcmp(char *, char *);
int convert(char *param) {
  int number = atoi(param);
  if (number > 0)
    return number;
  else if (number == 0) {
    int check = strcmp("0", param);
    if (check == number)
      return number;
    else if (check < 0)
      return UINT_MAX;
  }
  return UINT_MAX;
}


x86 assembly (clang, -O0):
<convert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    114d <convert+0x2d>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11b7 <convert+0x97>
cmpl   $0x0,-0x14(%rbp)
jne    11a6 <convert+0x86>
mov    -0x10(%rbp),%rsi
lea    0xe9e(%rip),%rdi
call   1030 <strcmp@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    1181 <convert+0x61>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11b7 <convert+0x97>
cmpl   $0x0,-0x18(%rbp)
jge    119c <convert+0x7c>
mov    0x2e56(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11b7 <convert+0x97>
jmp    11a1 <convert+0x81>
jmp    11a6 <convert+0x86>
jmp    11ab <convert+0x8b>
mov    0x2e36(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert>:
push   %rbx
mov    %rdi,%rbx
call   1040 <atoi@plt>
test   %eax,%eax
jle    112f <convert+0xf>
pop    %rbx
ret
jne    1144 <convert+0x24>
lea    0xec8(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     112d <convert+0xd>
mov    0x2e9d(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"0\00"
@UINT_MAX = global i32 0
define i32 @convert(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @atoi(i8* %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = load i32, i32* %4
store i32 %11, i32* %2
br label %33
12: ; preds = %1
%13 = load i32, i32* %4
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %30
15: ; preds = %12
%16 = load i8*, i8** %3
%17 = call i32 @strcmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %16)
store i32 %17, i32* %5
%18 = load i32, i32* %5
%19 = load i32, i32* %4
%20 = icmp eq i32 %18, %19
br i1 %20, label %21, label %23
21: ; preds = %15
%22 = load i32, i32* %4
store i32 %22, i32* %2
br label %33
23: ; preds = %15
%24 = load i32, i32* %5
%25 = icmp slt i32 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = load i32, i32* @UINT_MAX
store i32 %27, i32* %2
br label %33
28: ; preds = %23
br label %29
29: ; preds = %28
br label %30
30: ; preds = %29, %12
br label %31
31: ; preds = %30
%32 = load i32, i32* @UINT_MAX
store i32 %32, i32* %2
br label %33
33: ; preds = %31, %26, %21, %10
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
@.str = [2 x i8] c"0\00"
@UINT_MAX = global i32 0
define i32 @convert(i8* nocapture %0) {
%2 = tail call i32 @atoi(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1
%5 = icmp eq i32 %2, 0
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = load i32, i32* @UINT_MAX
br label %13
8: ; preds = %4
%9 = tail call i32 @strcmp(i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* dereferenceable(1) %0)
%10 = icmp eq i32 %9, 0
%11 = load i32, i32* @UINT_MAX
%12 = select i1 %10, i32 0, i32 %11
br label %13
13: ; preds = %8, %6, %1
%14 = phi i32 [ %2, %1 ], [ %7, %6 ], [ %12, %8 ]
ret i32 %14
}