#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*/ Store_Number(int, int *, int, char *);
int /*<<< orphan*/ scanf(char *, char *);
int strlen(char *);
int Scan_Number(char variable[]) {
  char input[1024];
  scanf("%s", input);
  int sign = 0, value[1024];
  int len = strlen(input);
  if (len > 0) {
    int i, j;
    if (input[0] == 45) {
      sign = 1;
      i = 1;
    } else
      i = 0;
    for (j = 0; i < len; i++) {
      if ((input[i] > 47) && (input[i] < 58))
        value[j] = input[i] - 48;
      else
        return 0x00;
      j++;
    }
    if (sign == 1)
      len--;
  }
  Store_Number(sign, &value[0], len, variable);
  return 0;
}


x86 assembly (clang, -O0):
<Scan_Number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1430,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x410(%rbp),%rsi
lea    0xeb3(%rip),%rdi
call   1050 <scanf@plt>
movl   $0x0,-0x414(%rbp)
lea    -0x410(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x1424(%rbp)
cmpl   $0x0,-0x1424(%rbp)
jle    126f <Scan_Number+0x13f>
movsbl -0x410(%rbp),%eax
cmp    $0x2d,%eax
jne    11a4 <Scan_Number+0x74>
movl   $0x1,-0x414(%rbp)
movl   $0x1,-0x1428(%rbp)
jmp    11ae <Scan_Number+0x7e>
movl   $0x0,-0x1428(%rbp)
movl   $0x0,-0x142c(%rbp)
mov    -0x1428(%rbp),%eax
cmp    -0x1424(%rbp),%eax
jge    124e <Scan_Number+0x11e>
movslq -0x1428(%rbp),%rax
movsbl -0x410(%rbp,%rax,1),%eax
ff
cmp    $0x2f,%eax
jle    121f <Scan_Number+0xef>
movslq -0x1428(%rbp),%rax
movsbl -0x410(%rbp,%rax,1),%eax
ff
cmp    $0x3a,%eax
jge    121f <Scan_Number+0xef>
movslq -0x1428(%rbp),%rax
movsbl -0x410(%rbp,%rax,1),%ecx
ff
sub    $0x30,%ecx
movslq -0x142c(%rbp),%rax
mov    %ecx,-0x1420(%rbp,%rax,4)
jmp    122b <Scan_Number+0xfb>
movl   $0x0,-0x4(%rbp)
jmp    1292 <Scan_Number+0x162>
mov    -0x142c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x142c(%rbp)
mov    -0x1428(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1428(%rbp)
jmp    11b8 <Scan_Number+0x88>
cmpl   $0x1,-0x414(%rbp)
jne    126a <Scan_Number+0x13a>
mov    -0x1424(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1424(%rbp)
jmp    126f <Scan_Number+0x13f>
mov    -0x414(%rbp),%edi
lea    -0x1420(%rbp),%rsi
mov    -0x1424(%rbp),%edx
mov    -0x10(%rbp),%rcx
call   1040 <Store_Number@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Scan_Number>:
push   %r14
push   %rbx
sub    $0x1408,%rsp
mov    %rdi,%r14
lea    0xebc(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    11ac <Scan_Number+0x7c>
mov    (%rsp),%r8b
xor    %edi,%edi
cmp    $0x2d,%r8b
sete   %dil
mov    %eax,%r9d
sub    %edi,%r9d
jbe    119f <Scan_Number+0x6f>
xor    %ecx,%ecx
cmp    $0x2d,%r8b
sete   %cl
lea    (%rsp,%rcx,1),%rsi
xor    %ebx,%ebx
movzbl (%rsi,%rbx,1),%ecx
lea    -0x30(%rcx),%edx
cmp    $0x9,%dl
ja     11c0 <Scan_Number+0x90>
add    $0xffffffd0,%ecx
mov    %ecx,0x400(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r9
jne    1180 <Scan_Number+0x50>
xor    %ecx,%ecx
cmp    $0x2d,%r8b
sete   %cl
sub    %ecx,%eax
jmp    11ae <Scan_Number+0x7e>
xor    %edi,%edi
lea    0x400(%rsp),%rsi
mov    %eax,%edx
mov    %r14,%rcx
call   1040 <Store_Number@plt>
xor    %eax,%eax
add    $0x1408,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @Scan_Number(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [1024 x i8]
%5 = alloca i32
%6 = alloca [1024 x i32]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %3
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %10)
store i32 0, i32* %5
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%13 = call i32 @strlen(i8* %12)
store i32 %13, i32* %7
%14 = load i32, i32* %7
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %66
16: ; preds = %1
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 45
br i1 %20, label %21, label %22
21: ; preds = %16
store i32 1, i32* %5
store i32 1, i32* %8
br label %23
22: ; preds = %16
store i32 0, i32* %8
br label %23
23: ; preds = %22, %21
store i32 0, i32* %9
br label %24
24: ; preds = %56, %23
%25 = load i32, i32* %8
%26 = load i32, i32* %7
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %59
28: ; preds = %24
%29 = load i32, i32* %8
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp sgt i32 %33, 47
br i1 %34, label %35, label %52
35: ; preds = %28
%36 = load i32, i32* %8
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %37
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp slt i32 %40, 58
br i1 %41, label %42, label %52
42: ; preds = %35
%43 = load i32, i32* %8
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %44
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = sub nsw i32 %47, 48
%49 = load i32, i32* %9
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [1024 x i32], [1024 x i32]* %6, i64 0, i64 %50
store i32 %48, i32* %51
br label %53
52: ; preds = %35, %28
store i32 0, i32* %2
br label %72
53: ; preds = %42
%54 = load i32, i32* %9
%55 = add nsw i32 %54, 1
store i32 %55, i32* %9
br label %56
56: ; preds = %53
%57 = load i32, i32* %8
%58 = add nsw i32 %57, 1
store i32 %58, i32* %8
br label %24
59: ; preds = %24
%60 = load i32, i32* %5
%61 = icmp eq i32 %60, 1
br i1 %61, label %62, label %65
62: ; preds = %59
%63 = load i32, i32* %7
%64 = add nsw i32 %63, -1
store i32 %64, i32* %7
br label %65
65: ; preds = %62, %59
br label %66
66: ; preds = %65, %1
%67 = load i32, i32* %5
%68 = getelementptr inbounds [1024 x i32], [1024 x i32]* %6, i64 0, i64 0
%69 = load i32, i32* %7
%70 = load i8*, i8** %3
%71 = call i32 @Store_Number(i32 %67, i32* %68, i32 %69, i8* %70)
store i32 0, i32* %2
br label %72
72: ; preds = %66, %52
%73 = load i32, i32* %2
ret i32 %73
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @Scan_Number(i8* %0) {
%2 = alloca [1024 x i8]
%3 = alloca [1024 x i32]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = bitcast [1024 x i32]* %3 to i8*
%7 = call i32 @strlen(i8* %4)
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %35
9: ; preds = %1
%10 = load i8, i8* %4
%11 = icmp eq i8 %10, 45
%12 = zext i1 %11 to i32
%13 = icmp ugt i32 %7, %12
br i1 %13, label %14, label %32
14: ; preds = %9
%15 = zext i1 %11 to i64
%16 = sub nuw nsw i32 %7, %12
%17 = zext i32 %16 to i64
br label %18
18: ; preds = %14, %25
%19 = phi i64 [ %15, %14 ], [ %30, %25 ]
%20 = phi i64 [ 0, %14 ], [ %29, %25 ]
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %19
%22 = load i8, i8* %21
%23 = add i8 %22, -48
%24 = icmp ult i8 %23, 10
br i1 %24, label %25, label %40
25: ; preds = %18
%26 = zext i8 %22 to i32
%27 = add nsw i32 %26, -48
%28 = getelementptr inbounds [1024 x i32], [1024 x i32]* %3, i64 0, i64 %20
store i32 %27, i32* %28
%29 = add nuw nsw i64 %20, 1
%30 = add nuw nsw i64 %19, 1
%31 = icmp eq i64 %29, %17
br i1 %31, label %32, label %18
32: ; preds = %25, %9
%33 = sext i1 %11 to i32
%34 = add nsw i32 %7, %33
br label %35
35: ; preds = %32, %1
%36 = phi i32 [ %12, %32 ], [ 0, %1 ]
%37 = phi i32 [ %34, %32 ], [ %7, %1 ]
%38 = getelementptr inbounds [1024 x i32], [1024 x i32]* %3, i64 0, i64 0
%39 = call i32 @Store_Number(i32 %36, i32* %38, i32 %37, i8* %0)
br label %40
40: ; preds = %18, %35
ret i32 0
}