#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 /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int strtol(char *, char **, int);
int parse_seed(char *arg) {
  int bn;
  if (arg) {
    bn = strtol(arg, (char **)0, 10);
    if (bn <= 0 || bn > 100) {
      printf("seed number <0 or >100 or not valid. Exiting...\n\n");
      exit(1);
    }
    printf("Seed number: %d\n", bn);
  } else {
    printf("Missing argument XX, seed number. Exiting...\n\n");
    exit(1);
  }
  return bn;
}


x86 assembly (clang, -O0):
<parse_seed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     119e <parse_seed+0x6e>
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1170 <parse_seed+0x40>
cmpl   $0x64,-0xc(%rbp)
jle    1188 <parse_seed+0x58>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0xc(%rbp),%esi
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b6 <parse_seed+0x86>
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_seed>:
push   %rbx
test   %rdi,%rdi
je     1170 <parse_seed+0x30>
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %eax,%ebx
lea    -0x65(%rbx),%eax
cmp    $0xffffff9b,%eax
jbe    1179 <parse_seed+0x39>
lea    0xe9d(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret
lea    0xe9a(%rip),%rdi
jmp    1180 <parse_seed+0x40>
lea    0xebf(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [50 x i8] c"seed number <0 or >100 or not valid. Exiting...\0A\0A\00"
@.str.1 = [17 x i8] c"Seed number: %d\0A\00"
@.str.2 = [47 x i8] c"Missing argument XX, seed number. Exiting...\0A\0A\00"
define i32 @parse_seed(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %20
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @strtol(i8* %7, i8** null, i32 10)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = icmp sle i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %6
%12 = load i32, i32* %3
%13 = icmp sgt i32 %12, 100
br i1 %13, label %14, label %17
14: ; preds = %11, %6
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %11
%18 = load i32, i32* %3
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %18)
br label %23
20: ; preds = %1
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %17
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
@.str.1 = [17 x i8] c"Seed number: %d\0A\00"
@str = [46 x i8] c"Missing argument XX, seed number. Exiting...\0A\00"
@str.3 = [49 x i8] c"seed number <0 or >100 or not valid. Exiting...\0A\00"
define i32 @parse_seed(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = tail call i32 @strtol(i8* nocapture %0, i8** null, i32 10)
%5 = add i32 %4, -101
%6 = icmp ult i32 %5, -100
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.3, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %3
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret i32 %4
12: ; preds = %1
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str, i64 0, i64 0))
%14 = tail call i32 @exit(i32 1)
unreachable
}