#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 *);
char *optionString(char **argv, int *num) {
  int next = *num + 1;
  char *result = argv[next];
  if (result == 0) {
    char temp[80];
    sprintf(temp, "Expected a string-parameter for %.20s", argv[*num]);
    Usage(temp);
  }
  *num = next;
  return result;
}


x86 assembly (clang, -O0):
<optionString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%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)
cmpq   $0x0,-0x20(%rbp)
jne    117f <optionString+0x5f>
lea    -0x70(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe8f(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
call   1030 <Usage@plt>
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<optionString>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rsi,%r14
movslq (%rsi),%rax
lea    0x1(%rax),%r12
mov    0x8(%rdi,%rax,8),%rbx
test   %rbx,%rbx
jne    115d <optionString+0x3d>
mov    (%rdi,%rax,8),%rdx
lea    0xeb6(%rip),%rsi
mov    %rsp,%r15
mov    %r15,%rdi
call   1040 <sprintf@plt>
mov    %r15,%rdi
call   1030 <Usage@plt>
mov    %r12d,(%r14)
mov    %rbx,%rax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [38 x i8] c"Expected a string-parameter for %.20s\00"
define i8* @optionString(i8** nocapture %0, i32* nocapture %1) {
%3 = alloca [80 x i8]
%4 = load i32, i32* %1
%5 = add nsw i32 %4, 1
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i8*, i8** %0, i64 %6
%8 = load i8*, i8** %7
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %17
10: ; preds = %2
%11 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%12 = sext i32 %4 to i64
%13 = getelementptr inbounds i8*, i8** %0, i64 %12
%14 = load i8*, i8** %13
%15 = call i32 @sprintf(i8* %11, i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = call i32 @Usage(i8* %11)
br label %17
17: ; preds = %10, %2
store i32 %5, i32* %1
ret i8* %8
}