#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*/ STDERR_FILENO;
size_t strlen(char const *);
int /*<<< orphan*/ write(int /*<<< orphan*/, char *, int);
const char *getarraysize(const char *o) {
  const char *n;
  size_t s;
  if (sizeof(long) == 4)
    s = 10;
  else
    s = 20;
  while (*o == '0') {
    if (*++o == '\0') {
      write(STDERR_FILENO, "bfc: -y can't be 0\n", 19);
      return "65536";
    }
  }
  if (strlen(o) > s) {
    write(STDERR_FILENO, "bfc: invalid -y option\n", 23);
    return "65536";
  }
  n = o;
  while (*o != '\0') {
    if (*o < '0' || *o++ > '9') {
      write(STDERR_FILENO, "bfc: invalid -y number\n", 23);
      return "65536";
    }
  }
  return n;
}


x86 assembly (clang, -O0):
<getarraysize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x14,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jne    118f <getarraysize+0x6f>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
jne    118a <getarraysize+0x6a>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
lea    0xe90(%rip),%rsi
mov    $0x13,%edx
call   1030 <write@plt>
lea    0xe93(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1246 <getarraysize+0x126>
jmp    1134 <getarraysize+0x14>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
cmp    -0x20(%rbp),%rax
jbe    11cc <getarraysize+0xac>
mov    0x2e37(%rip),%rax
mov    (%rax),%edi
lea    0xe68(%rip),%rsi
mov    $0x17,%edx
call   1030 <write@plt>
lea    0xe51(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1246 <getarraysize+0x126>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     123e <getarraysize+0x11e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jl     120f <getarraysize+0xef>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
cmp    $0x39,%eax
jle    1239 <getarraysize+0x119>
mov    0x2dca(%rip),%rax
mov    (%rax),%edi
lea    0xe13(%rip),%rsi
mov    $0x17,%edx
call   1030 <write@plt>
lea    0xde4(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1246 <getarraysize+0x126>
jmp    11d4 <getarraysize+0xb4>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getarraysize>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%bpl
add    $0x1,%rbx
xchg   %ax,%ax
cmp    $0x30,%bpl
jne    1159 <getarraysize+0x39>
movzbl (%rbx),%ebp
add    $0x1,%rbx
test   %bpl,%bpl
jne    1130 <getarraysize+0x10>
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
lea    0xeae(%rip),%rsi
mov    $0x13,%edx
jmp    11ad <getarraysize+0x8d>
lea    -0x1(%rbx),%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
cmp    $0x14,%rax
jbe    1180 <getarraysize+0x60>
mov    0x2e6e(%rip),%rax
mov    (%rax),%edi
lea    0xe9f(%rip),%rsi
jmp    11a8 <getarraysize+0x88>
nopl   (%rax)
test   %bpl,%bpl
je     11b9 <getarraysize+0x99>
add    $0xc6,%bpl
cmp    $0xf6,%bpl
jb     1198 <getarraysize+0x78>
movzbl (%rbx),%ebp
add    $0x1,%rbx
jmp    1180 <getarraysize+0x60>
mov    0x2e41(%rip),%rax
mov    (%rax),%edi
lea    0xe8a(%rip),%rsi
mov    $0x17,%edx
call   1030 <write@plt>
lea    0xe5b(%rip),%r14
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@STDERR_FILENO = global i32 0
@.str = [20 x i8] c"bfc: -y can't be 0\0A\00"
@.str.1 = [6 x i8] c"65536\00"
@.str.2 = [24 x i8] c"bfc: invalid -y option\0A\00"
@.str.3 = [24 x i8] c"bfc: invalid -y number\0A\00"
define i8* @getarraysize(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
store i8* %0, i8** %3
store i64 20, i64* %5
br label %6
6: ; preds = %20, %1
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 48
br i1 %10, label %11, label %21
11: ; preds = %6
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %3
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %11
%18 = load i32, i32* @STDERR_FILENO
%19 = call i32 @write(i32 %18, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 19)
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %53
20: ; preds = %11
br label %6
21: ; preds = %6
%22 = load i8*, i8** %3
%23 = call i64 @strlen(i8* %22)
%24 = load i64, i64* %5
%25 = icmp ugt i64 %23, %24
br i1 %25, label %26, label %29
26: ; preds = %21
%27 = load i32, i32* @STDERR_FILENO
%28 = call i32 @write(i32 %27, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 23)
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %53
29: ; preds = %21
%30 = load i8*, i8** %3
store i8* %30, i8** %4
br label %31
31: ; preds = %50, %29
%32 = load i8*, i8** %3
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %51
36: ; preds = %31
%37 = load i8*, i8** %3
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp slt i32 %39, 48
br i1 %40, label %47, label %41
41: ; preds = %36
%42 = load i8*, i8** %3
%43 = getelementptr inbounds i8, i8* %42, i32 1
store i8* %43, i8** %3
%44 = load i8, i8* %42
%45 = sext i8 %44 to i32
%46 = icmp sgt i32 %45, 57
br i1 %46, label %47, label %50
47: ; preds = %41, %36
%48 = load i32, i32* @STDERR_FILENO
%49 = call i32 @write(i32 %48, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 23)
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %53
50: ; preds = %41
br label %31
51: ; preds = %31
%52 = load i8*, i8** %4
store i8* %52, i8** %2
br label %53
53: ; preds = %51, %47, %26, %17
%54 = load i8*, i8** %2
ret i8* %54
}

LLVM IR (-O2):
@STDERR_FILENO = global i32 0
@.str = [20 x i8] c"bfc: -y can't be 0\0A\00"
@.str.1 = [6 x i8] c"65536\00"
@.str.2 = [24 x i8] c"bfc: invalid -y option\0A\00"
@.str.3 = [24 x i8] c"bfc: invalid -y number\0A\00"
define i8* @getarraysize(i8* %0) {
%2 = load i8, i8* %0
br label %3
3: ; preds = %7, %1
%4 = phi i8 [ %9, %7 ], [ %2, %1 ]
%5 = phi i8* [ %8, %7 ], [ %0, %1 ]
%6 = icmp eq i8 %4, 48
br i1 %6, label %7, label %14
7: ; preds = %3
%8 = getelementptr inbounds i8, i8* %5, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %3
11: ; preds = %7
%12 = load i32, i32* @STDERR_FILENO
%13 = tail call i32 @write(i32 %12, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 19)
br label %34
14: ; preds = %3
%15 = tail call i64 @strlen(i8* %5)
%16 = icmp ugt i64 %15, 20
br i1 %16, label %19, label %17
17: ; preds = %14
%18 = icmp eq i8 %4, 0
br i1 %18, label %34, label %22
19: ; preds = %14
%20 = load i32, i32* @STDERR_FILENO
%21 = tail call i32 @write(i32 %20, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 23)
br label %34
22: ; preds = %17, %28
%23 = phi i8* [ %25, %28 ], [ %5, %17 ]
%24 = phi i8 [ %29, %28 ], [ %4, %17 ]
%25 = getelementptr inbounds i8, i8* %23, i64 1
%26 = add i8 %24, -58
%27 = icmp ult i8 %26, -10
br i1 %27, label %31, label %28
28: ; preds = %22
%29 = load i8, i8* %25
%30 = icmp eq i8 %29, 0
br i1 %30, label %34, label %22
31: ; preds = %22
%32 = load i32, i32* @STDERR_FILENO
%33 = tail call i32 @write(i32 %32, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 23)
br label %34
34: ; preds = %28, %17, %31, %19, %11
%35 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), %11 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), %19 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), %31 ], [ %5, %17 ], [ %5, %28 ]
ret i8* %35
}