#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 */
double atof(char *);
scalar_t__ is_number(char *);
int get_tail_length(int argc, char *argv[]) {
  double place_holder;
  if (argc > 1 && argv[1][0] == '-' && is_number(argv[1]) &&
      (place_holder =
           ((atof(argv[1])) < 0) ? -(atof(argv[1])) : (atof(argv[1]))) < 5000)
    return (int)place_holder;
  else
    return 10;
}


x86 assembly (clang, -O0):
<get_tail_length>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    11ea <get_tail_length+0xca>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    11ea <get_tail_length+0xca>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <is_number@plt>
cmp    $0x0,%rax
je     11ea <get_tail_length+0xca>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atof@plt>
movaps %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    11af <get_tail_length+0x8f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atof@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    11c1 <get_tail_length+0xa1>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atof@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  %xmm1,-0x18(%rbp)
movsd  0xe2d(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11ea <get_tail_length+0xca>
cvttsd2si -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11f1 <get_tail_length+0xd1>
movl   $0xa,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_tail_length>:
push   %rbp
push   %rbx
push   %rax
mov    $0xa,%ebp
cmp    $0x2,%edi
jl     1183 <get_tail_length+0x63>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
cmpb   $0x2d,(%rdi)
jne    1183 <get_tail_length+0x63>
call   1030 <is_number@plt>
test   %rax,%rax
je     1183 <get_tail_length+0x63>
mov    0x8(%rbx),%rdi
call   1040 <atof@plt>
movapd 0xeac(%rip),%xmm2
xorpd  %xmm0,%xmm2
xorpd  %xmm3,%xmm3
movapd %xmm0,%xmm1
cmpltsd %xmm3,%xmm1
andpd  %xmm1,%xmm2
andnpd %xmm0,%xmm1
orpd   %xmm2,%xmm1
movsd  0xe97(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1183 <get_tail_length+0x63>
cvttsd2si %xmm1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @get_tail_length(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %46
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = getelementptr inbounds i8, i8* %12, i64 0
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 45
br i1 %16, label %17, label %46
17: ; preds = %9
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i64 @is_number(i8* %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %46
23: ; preds = %17
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call double @atof(i8* %26)
%28 = fcmp olt double %27, 0.000000e+00
br i1 %28, label %29, label %35
29: ; preds = %23
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = call double @atof(i8* %32)
%34 = fneg double %33
br label %40
35: ; preds = %23
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
%39 = call double @atof(i8* %38)
br label %40
40: ; preds = %35, %29
%41 = phi double [ %34, %29 ], [ %39, %35 ]
store double %41, double* %6
%42 = fcmp olt double %41, 5.000000e+03
br i1 %42, label %43, label %46
43: ; preds = %40
%44 = load double, double* %6
%45 = fptosi double %44 to i32
store i32 %45, i32* %3
br label %47
46: ; preds = %40, %17, %9, %2
store i32 10, i32* %3
br label %47
47: ; preds = %46, %43
%48 = load i32, i32* %3
ret i32 %48
}

LLVM IR (-O2):
define i32 @get_tail_length(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %21
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 45
br i1 %8, label %9, label %21
9: ; preds = %4
%10 = tail call i64 @is_number(i8* %6)
%11 = icmp eq i64 %10, 0
br i1 %11, label %21, label %12
12: ; preds = %9
%13 = load i8*, i8** %5
%14 = tail call double @atof(i8* %13)
%15 = fcmp olt double %14, 0.000000e+00
%16 = fneg double %14
%17 = select i1 %15, double %16, double %14
%18 = fcmp olt double %17, 5.000000e+03
br i1 %18, label %19, label %21
19: ; preds = %12
%20 = fptosi double %17 to i32
br label %21
21: ; preds = %2, %4, %9, %12, %19
%22 = phi i32 [ %20, %19 ], [ 10, %12 ], [ 10, %9 ], [ 10, %4 ], [ 10, %2 ]
ret i32 %22
}