#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_bars(char *arg) {
  int bn;
  if (arg) {
    bn = strtol(arg, (char **)0, 10);
    if (bn <= 0 || bn > 256) {
      printf("bars number <0 or >256 or not valid. Exiting...\n\n");
      exit(1);
    }
    printf("Number of bars: %d\n", bn);
  } else {
    printf("Missing argument 3, number of bars. Exiting...\n\n");
    exit(1);
  }
  return bn;
}


x86 assembly (clang, -O0):
<parse_bars>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     11a1 <parse_bars+0x71>
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    1173 <parse_bars+0x43>
cmpl   $0x100,-0xc(%rbp)
jle    118b <parse_bars+0x5b>
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0xc(%rbp),%esi
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b9 <parse_bars+0x89>
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_bars>:
push   %rbx
test   %rdi,%rdi
je     1175 <parse_bars+0x35>
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %eax,%ebx
lea    -0x101(%rbx),%eax
cmp    $0xfffffeff,%eax
jbe    117e <parse_bars+0x3e>
lea    0xe98(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret
lea    0xe98(%rip),%rdi
jmp    1185 <parse_bars+0x45>
lea    0xebf(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [50 x i8] c"bars number <0 or >256 or not valid. Exiting...\0A\0A\00"
@.str.1 = [20 x i8] c"Number of bars: %d\0A\00"
@.str.2 = [49 x i8] c"Missing argument 3, number of bars. Exiting...\0A\0A\00"
define i32 @parse_bars(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, 256
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 ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %18)
br label %23
20: ; preds = %1
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 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 = [20 x i8] c"Number of bars: %d\0A\00"
@str = [48 x i8] c"Missing argument 3, number of bars. Exiting...\0A\00"
@str.3 = [49 x i8] c"bars number <0 or >256 or not valid. Exiting...\0A\00"
define i32 @parse_bars(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, -257
%6 = icmp ult i32 %5, -256
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 ([20 x i8], [20 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 ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%14 = tail call i32 @exit(i32 1)
unreachable
}