#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*/ my_putstr2(char *);
int error_getnbr(long int result, int neg) {
  result = result * neg;
  if (result >= 2147483647) {
    my_putstr2("\nError : This string can't be transform in a number\n");
    my_putstr2("This number is too high to be store in an int\n");
    my_putstr2("For this reason, the program will stopped by himself\n\n");
    exit(-1);
  }
  if (result <= -2147483647) {
    my_putstr2("\nError : This string can't be transform in a number\n");
    my_putstr2("This number is too low to be store in an int\n");
    my_putstr2("For this reason, the program will stopped by himself\n\n");
    exit(-1);
  }
  return (result);
}


x86 assembly (clang, -O0):
<error_getnbr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   %rcx,%rax
mov    %rax,-0x8(%rbp)
cmpq   $0x7fffffff,-0x8(%rbp)
7f
jl     117b <error_getnbr+0x5b>
lea    0xeac(%rip),%rdi
call   1030 <my_putstr2@plt>
lea    0xed5(%rip),%rdi
call   1030 <my_putstr2@plt>
lea    0xef8(%rip),%rdi
call   1030 <my_putstr2@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>
cmpq   $0xffffffff80000001,-0x8(%rbp)
80
jg     11b7 <error_getnbr+0x97>
lea    0xe70(%rip),%rdi
call   1030 <my_putstr2@plt>
lea    0xeff(%rip),%rdi
call   1030 <my_putstr2@plt>
lea    0xebc(%rip),%rdi
call   1030 <my_putstr2@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<error_getnbr>:
push   %rax
movslq %esi,%rax
imul   %rdi,%rax
cmp    $0x7fffffff,%rax
jge    113a <error_getnbr+0x1a>
cmp    $0xffffffff80000001,%rax
jle    114f <error_getnbr+0x2f>
pop    %rcx
ret
lea    0xebf(%rip),%rdi
call   1030 <my_putstr2@plt>
lea    0xee8(%rip),%rdi
jmp    1162 <error_getnbr+0x42>
lea    0xeaa(%rip),%rdi
call   1030 <my_putstr2@plt>
lea    0xf39(%rip),%rdi
call   1030 <my_putstr2@plt>
lea    0xef6(%rip),%rdi
call   1030 <my_putstr2@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [53 x i8] c"\0AError : This string can't be transform in a number\0A\00"
@.str.1 = [47 x i8] c"This number is too high to be store in an int\0A\00"
@.str.2 = [55 x i8] c"For this reason, the program will stopped by himself\0A\0A\00"
@.str.3 = [46 x i8] c"This number is too low to be store in an int\0A\00"
define i32 @error_getnbr(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%5 = load i64, i64* %3
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = mul nsw i64 %5, %7
store i64 %8, i64* %3
%9 = load i64, i64* %3
%10 = icmp sge i64 %9, 2147483647
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = call i32 @my_putstr2(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @my_putstr2(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 @my_putstr2(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 @exit(i32 -1)
unreachable
16: ; preds = %2
%17 = load i64, i64* %3
%18 = icmp sle i64 %17, -2147483647
br i1 %18, label %19, label %24
19: ; preds = %16
%20 = call i32 @my_putstr2(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%21 = call i32 @my_putstr2(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
%22 = call i32 @my_putstr2(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0))
%23 = call i32 @exit(i32 -1)
unreachable
24: ; preds = %16
%25 = load i64, i64* %3
%26 = trunc i64 %25 to i32
ret i32 %26
}

LLVM IR (-O2):
@.str = [53 x i8] c"\0AError : This string can't be transform in a number\0A\00"
@.str.1 = [47 x i8] c"This number is too high to be store in an int\0A\00"
@.str.2 = [55 x i8] c"For this reason, the program will stopped by himself\0A\0A\00"
@.str.3 = [46 x i8] c"This number is too low to be store in an int\0A\00"
define i32 @error_getnbr(i64 %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = mul nsw i64 %3, %0
%5 = icmp sgt i64 %4, 2147483646
br i1 %5, label %6, label %11
6: ; preds = %2
%7 = tail call i32 @my_putstr2(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @my_putstr2(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 @my_putstr2(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0))
%10 = tail call i32 @exit(i32 -1)
unreachable
11: ; preds = %2
%12 = icmp slt i64 %4, -2147483646
br i1 %12, label %13, label %18
13: ; preds = %11
%14 = tail call i32 @my_putstr2(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%15 = tail call i32 @my_putstr2(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
%16 = tail call i32 @my_putstr2(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0))
%17 = tail call i32 @exit(i32 -1)
unreachable
18: ; preds = %11
%19 = trunc i64 %4 to i32
ret i32 %19
}