#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*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ isdigit(char const);
int /*<<< orphan*/ stderr;
int check_number(const char *num, const char *opt) {
  const char *c;
  for (c = num; *c != '\0'; c++) {
    if (!isdigit(*c)) {
      fprintf(stderr, "Integer expected for option %s\n", opt);
      return 0;
    }
  }
  return c != num;
}


x86 assembly (clang, -O0):
<check_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1198 <check_number+0x78>
mov    -0x20(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    1182 <check_number+0x62>
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xe8f(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11ab <check_number+0x8b>
jmp    1187 <check_number+0x67>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1138 <check_number+0x18>
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_number>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
mov    (%rdi),%al
mov    %rdi,%rbx
test   %al,%al
je     1158 <check_number+0x38>
mov    %rsi,%r14
mov    %r15,%rbx
nopw   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     1162 <check_number+0x42>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1140 <check_number+0x20>
xor    %eax,%eax
cmp    %r15,%rbx
setne  %al
jmp    117c <check_number+0x5c>
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
lea    0xe8e(%rip),%rsi
mov    %r14,%rdx
call   1040 <fprintf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [32 x i8] c"Integer expected for option %s\0A\00"
define i32 @check_number(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %4
store i8* %7, i8** %6
br label %8
8: ; preds = %23, %2
%9 = load i8*, i8** %6
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %26
13: ; preds = %8
%14 = load i8*, i8** %6
%15 = load i8, i8* %14
%16 = call i32 @isdigit(i8 signext %15)
%17 = icmp ne i32 %16, 0
br i1 %17, label %22, label %18
18: ; preds = %13
%19 = load i32, i32* @stderr
%20 = load i8*, i8** %5
%21 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %20)
store i32 0, i32* %3
br label %31
22: ; preds = %13
br label %23
23: ; preds = %22
%24 = load i8*, i8** %6
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %6
br label %8
26: ; preds = %8
%27 = load i8*, i8** %6
%28 = load i8*, i8** %4
%29 = icmp ne i8* %27, %28
%30 = zext i1 %29 to i32
store i32 %30, i32* %3
br label %31
31: ; preds = %26, %18
%32 = load i32, i32* %3
ret i32 %32
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [32 x i8] c"Integer expected for option %s\0A\00"
define i32 @check_number(i8* %0, i8* %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %17, label %5
5: ; preds = %2, %13
%6 = phi i8 [ %15, %13 ], [ %3, %2 ]
%7 = phi i8* [ %14, %13 ], [ %0, %2 ]
%8 = tail call i32 @isdigit(i8 signext %6)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %5
%11 = load i32, i32* @stderr
%12 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %21
13: ; preds = %5
%14 = getelementptr inbounds i8, i8* %7, i64 1
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %5
17: ; preds = %13, %2
%18 = phi i8* [ %0, %2 ], [ %14, %13 ]
%19 = icmp ne i8* %18, %0
%20 = zext i1 %19 to i32
br label %21
21: ; preds = %17, %10
%22 = phi i32 [ 0, %10 ], [ %20, %17 ]
ret i32 %22
}