#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 *, ...);
int sscanf(char *, char *, int *, char *);
int /*<<< orphan*/ stderr;
int pl_Int(void *variable, int argc, char *argv[], int i, int k) {
  char c = '\0';
  if (i >= argc) {
    fprintf(stderr, "The command line is missing an integer at its end.\n\n");
    return (0);
  } else if ((sscanf(&argv[i][k], "%d%c", (int *)variable, &c) != 1) ||
             (c != '\0')) {
    fprintf(stderr, "\"%s\" (from item %d on the command line) ", &argv[i][k],
            i);
    fprintf(stderr, "is not an integer.\n\n");
    return (0);
  } else
    return (i + 1);
}


x86 assembly (clang, -O0):
<pl_Int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8d,-0x28(%rbp)
movb   $0x0,-0x29(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jl     116d <pl_Int+0x4d>
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
lea    0xea6(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1203 <pl_Int+0xe3>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
movslq -0x28(%rbp),%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rdx
lea    0xeaa(%rip),%rsi
lea    -0x29(%rbp),%rcx
call   1040 <sscanf@plt>
cmp    $0x1,%eax
jne    11aa <pl_Int+0x8a>
movsbl -0x29(%rbp),%eax
cmp    $0x0,%eax
je     11fa <pl_Int+0xda>
mov    0x2e2f(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
movslq -0x28(%rbp),%rax
add    %rax,%rdx
mov    -0x24(%rbp),%ecx
lea    0xe6a(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e02(%rip),%rax
mov    (%rax),%edi
lea    0xe7c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1203 <pl_Int+0xe3>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pl_Int>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
movb   $0x0,0xf(%rsp)
cmp    %esi,%ecx
jge    116e <pl_Int+0x4e>
mov    %ecx,%ebx
mov    %rdx,%r14
mov    %rdi,%rdx
movslq %ecx,%rbp
movslq %r8d,%r15
mov    (%r14,%rbp,8),%rdi
add    %r15,%rdi
lea    0xee4(%rip),%rsi
lea    0xf(%rsp),%rcx
call   1040 <sscanf@plt>
cmp    $0x1,%eax
jne    1182 <pl_Int+0x62>
cmpb   $0x0,0xf(%rsp)
jne    1182 <pl_Int+0x62>
add    $0x1,%ebx
mov    %ebx,%ebp
jmp    11b8 <pl_Int+0x98>
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
lea    0xe82(%rip),%rsi
xor    %ebp,%ebp
jmp    11b1 <pl_Int+0x91>
mov    0x2e57(%rip),%r12
mov    (%r12),%edi
add    (%r14,%rbp,8),%r15
lea    0xea2(%rip),%rsi
xor    %ebp,%ebp
mov    %r15,%rdx
mov    %ebx,%ecx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r12),%edi
lea    0xeb2(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %ebp,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [53 x i8] c"The command line is missing an integer at its end.\0A\0A\00"
@.str.1 = [5 x i8] c"%d%c\00"
@.str.2 = [41 x i8] c"\22%s\22 (from item %d on the command line) \00"
@.str.3 = [21 x i8] c"is not an integer.\0A\0A\00"
define i32 @pl_Int(i8* %0, i32 %1, i8** %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8**
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8
store i8* %0, i8** %7
store i32 %1, i32* %8
store i8** %2, i8*** %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i8 0, i8* %12
%13 = load i32, i32* %10
%14 = load i32, i32* %8
%15 = icmp sge i32 %13, %14
br i1 %15, label %16, label %19
16: ; preds = %5
%17 = load i32, i32* @stderr
%18 = call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %6
br label %53
19: ; preds = %5
%20 = load i8**, i8*** %9
%21 = load i32, i32* %10
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8*, i8** %20, i64 %22
%24 = load i8*, i8** %23
%25 = load i32, i32* %11
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %24, i64 %26
%28 = load i8*, i8** %7
%29 = bitcast i8* %28 to i32*
%30 = call i32 @sscanf(i8* %27, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %29, i8* %12)
%31 = icmp ne i32 %30, 1
br i1 %31, label %36, label %32
32: ; preds = %19
%33 = load i8, i8* %12
%34 = sext i8 %33 to i32
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %50
36: ; preds = %32, %19
%37 = load i32, i32* @stderr
%38 = load i8**, i8*** %9
%39 = load i32, i32* %10
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8*, i8** %38, i64 %40
%42 = load i8*, i8** %41
%43 = load i32, i32* %11
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %42, i64 %44
%46 = load i32, i32* %10
%47 = call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i8* %45, i32 %46)
%48 = load i32, i32* @stderr
%49 = call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %6
br label %53
50: ; preds = %32
%51 = load i32, i32* %10
%52 = add nsw i32 %51, 1
store i32 %52, i32* %6
br label %53
53: ; preds = %50, %36, %16
%54 = load i32, i32* %6
ret i32 %54
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [53 x i8] c"The command line is missing an integer at its end.\0A\0A\00"
@.str.1 = [5 x i8] c"%d%c\00"
@.str.2 = [41 x i8] c"\22%s\22 (from item %d on the command line) \00"
@.str.3 = [21 x i8] c"is not an integer.\0A\0A\00"
define i32 @pl_Int(i8* %0, i32 %1, i8** nocapture %2, i32 %3, i32 %4) {
%6 = alloca i8
store i8 0, i8* %6
%7 = icmp slt i32 %3, %1
br i1 %7, label %11, label %8
8: ; preds = %5
%9 = load i32, i32* @stderr
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
br label %32
11: ; preds = %5
%12 = sext i32 %3 to i64
%13 = getelementptr inbounds i8*, i8** %2, i64 %12
%14 = load i8*, i8** %13
%15 = sext i32 %4 to i64
%16 = getelementptr inbounds i8, i8* %14, i64 %15
%17 = bitcast i8* %0 to i32*
%18 = call i32 @sscanf(i8* %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %17, i8* %6)
%19 = icmp ne i32 %18, 1
%20 = load i8, i8* %6
%21 = icmp ne i8 %20, 0
%22 = select i1 %19, i1 true, i1 %21
br i1 %22, label %23, label %30
23: ; preds = %11
%24 = load i32, i32* @stderr
%25 = load i8*, i8** %13
%26 = getelementptr inbounds i8, i8* %25, i64 %15
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i8* %26, i32 %3)
%28 = load i32, i32* @stderr
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
br label %32
30: ; preds = %11
%31 = add nsw i32 %3, 1
br label %32
32: ; preds = %30, %23, %8
%33 = phi i32 [ 0, %8 ], [ 0, %23 ], [ %31, %30 ]
ret i32 %33
}