#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*/ Usage(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int strtol(char *, char **, int /*<<< orphan*/);
int optionValue(char **argv, int *num) {
  int next = *num + 1;
  char *src = argv[next];
  char *tmp = 0;
  int result = 0;
  if (src != 0) {
    result = strtol(src, &tmp, 0);
    if (tmp == 0 || *tmp != 0)
      src = 0;
  }
  if (src == 0) {
    char temp[80];
    sprintf(temp, "Expected a numeric-parameter for %.20s", argv[*num]);
    Usage(temp);
  }
  *num = next;
  return result;
}


x86 assembly (clang, -O0):
<optionValue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11b3 <optionValue+0x83>
mov    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
xor    %edx,%edx
call   1040 <strtol@plt>
mov    %eax,-0x2c(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11a6 <optionValue+0x76>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11ae <optionValue+0x7e>
movq   $0x0,-0x20(%rbp)
jmp    11b3 <optionValue+0x83>
cmpq   $0x0,-0x20(%rbp)
jne    11e6 <optionValue+0xb6>
lea    -0x80(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe28(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x80(%rbp),%rdi
call   1030 <Usage@plt>
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x2c(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<optionValue>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
movslq (%rsi),%rbp
mov    0x8(%rdi,%rbp,8),%rdi
add    $0x1,%rbp
movq   $0x0,0x8(%rsp)
test   %rdi,%rdi
je     117a <optionValue+0x4a>
lea    0x8(%rsp),%rsi
xor    %edx,%edx
call   1040 <strtol@plt>
mov    %eax,%r15d
mov    0x8(%rsp),%rax
test   %rax,%rax
je     117d <optionValue+0x4d>
cmpb   $0x0,(%rax)
jne    117d <optionValue+0x4d>
jmp    11a0 <optionValue+0x70>
xor    %r15d,%r15d
movslq (%rbx),%rax
mov    (%r14,%rax,8),%rdx
lea    0xe75(%rip),%rsi
lea    0x10(%rsp),%r14
mov    %r14,%rdi
call   1050 <sprintf@plt>
mov    %r14,%rdi
call   1030 <Usage@plt>
mov    %ebp,(%rbx)
mov    %r15d,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [39 x i8] c"Expected a numeric-parameter for %.20s\00"
define i32 @optionValue(i8** %0, i32* %1) {
%3 = alloca i8**
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca [80 x i8]
store i8** %0, i8*** %3
store i32* %1, i32** %4
%10 = load i32*, i32** %4
%11 = load i32, i32* %10
%12 = add nsw i32 %11, 1
store i32 %12, i32* %5
%13 = load i8**, i8*** %3
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8*, i8** %13, i64 %15
%17 = load i8*, i8** %16
store i8* %17, i8** %6
store i8* null, i8** %7
store i32 0, i32* %8
%18 = load i8*, i8** %6
%19 = icmp ne i8* %18, null
br i1 %19, label %20, label %32
20: ; preds = %2
%21 = load i8*, i8** %6
%22 = call i32 @strtol(i8* %21, i8** %7, i32 0)
store i32 %22, i32* %8
%23 = load i8*, i8** %7
%24 = icmp eq i8* %23, null
br i1 %24, label %30, label %25
25: ; preds = %20
%26 = load i8*, i8** %7
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %25, %20
store i8* null, i8** %6
br label %31
31: ; preds = %30, %25
br label %32
32: ; preds = %31, %2
%33 = load i8*, i8** %6
%34 = icmp eq i8* %33, null
br i1 %34, label %35, label %46
35: ; preds = %32
%36 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%37 = load i8**, i8*** %3
%38 = load i32*, i32** %4
%39 = load i32, i32* %38
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8*, i8** %37, i64 %40
%42 = load i8*, i8** %41
%43 = call i32 @sprintf(i8* %36, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %42)
%44 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%45 = call i32 @Usage(i8* %44)
br label %46
46: ; preds = %35, %32
%47 = load i32, i32* %5
%48 = load i32*, i32** %4
store i32 %47, i32* %48
%49 = load i32, i32* %8
ret i32 %49
}

LLVM IR (-O2):
@.str = [39 x i8] c"Expected a numeric-parameter for %.20s\00"
define i32 @optionValue(i8** nocapture %0, i32* nocapture %1) {
%3 = alloca i8*
%4 = alloca [80 x i8]
%5 = load i32, i32* %1
%6 = add nsw i32 %5, 1
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8*, i8** %0, i64 %7
%9 = load i8*, i8** %8
%10 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%11 = icmp eq i8* %9, null
br i1 %11, label %19, label %12
12: ; preds = %2
%13 = call i32 @strtol(i8* %9, i8** %3, i32 0)
%14 = load i8*, i8** %3
%15 = icmp eq i8* %14, null
br i1 %15, label %19, label %16
16: ; preds = %12
%17 = load i8, i8* %14
%18 = icmp eq i8 %17, 0
br i1 %18, label %28, label %19
19: ; preds = %12, %16, %2
%20 = phi i32 [ 0, %2 ], [ %13, %16 ], [ %13, %12 ]
%21 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%22 = load i32, i32* %1
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8*, i8** %0, i64 %23
%25 = load i8*, i8** %24
%26 = call i32 @sprintf(i8* %21, i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %25)
%27 = call i32 @Usage(i8* %21)
br label %28
28: ; preds = %16, %19
%29 = phi i32 [ %20, %19 ], [ %13, %16 ]
store i32 %6, i32* %1
ret i32 %29
}