#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*/ sprintf(char *, char *, char const *);
scalar_t__ sscanf(char const *, char *, int *);
int parseTranspose(const char *val, int *vp, char *msg) {
  if (sscanf(val, "%d", vp) == 0) {
    sprintf(msg, "Transpose: integer expected : '%s'", val);
    return -1;
  } else if (((*vp) < -127) || (127 < (*vp))) {
    sprintf(msg, "Transpose: argument out of range : '%s'", val);
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<parseTranspose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xebd(%rip),%rsi
call   1030 <sscanf@plt>
cmp    $0x0,%rax
jne    1172 <parseTranspose+0x52>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xea2(%rip),%rsi
call   1040 <sprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11bc <parseTranspose+0x9c>
mov    -0x18(%rbp),%rax
cmpl   $0xffffff81,(%rax)
jl     1190 <parseTranspose+0x70>
mov    -0x18(%rbp),%rcx
mov    $0x7f,%eax
cmp    (%rcx),%eax
jge    11b0 <parseTranspose+0x90>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe87(%rip),%rsi
call   1040 <sprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11bc <parseTranspose+0x9c>
jmp    11b5 <parseTranspose+0x95>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parseTranspose>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
lea    0xecb(%rip),%rsi
mov    %rbx,%rdx
call   1030 <sscanf@plt>
test   %rax,%rax
je     115a <parseTranspose+0x3a>
mov    (%rbx),%ecx
add    $0xffffff80,%ecx
xor    %eax,%eax
cmp    $0xffffff00,%ecx
ja     1171 <parseTranspose+0x51>
lea    0xece(%rip),%rsi
jmp    1161 <parseTranspose+0x41>
lea    0xea2(%rip),%rsi
mov    %r14,%rdi
mov    %r15,%rdx
call   1040 <sprintf@plt>
mov    $0xffffffff,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [35 x i8] c"Transpose: integer expected : '%s'\00"
@.str.2 = [40 x i8] c"Transpose: argument out of range : '%s'\00"
define i32 @parseTranspose(i8* %0, i32* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i8*
store i8* %0, i8** %5
store i32* %1, i32** %6
store i8* %2, i8** %7
%8 = load i8*, i8** %5
%9 = load i32*, i32** %6
%10 = call i64 @sscanf(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %3
%13 = load i8*, i8** %7
%14 = load i8*, i8** %5
%15 = call i32 @sprintf(i8* %13, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %14)
store i32 -1, i32* %4
br label %30
16: ; preds = %3
%17 = load i32*, i32** %6
%18 = load i32, i32* %17
%19 = icmp slt i32 %18, -127
br i1 %19, label %24, label %20
20: ; preds = %16
%21 = load i32*, i32** %6
%22 = load i32, i32* %21
%23 = icmp slt i32 127, %22
br i1 %23, label %24, label %28
24: ; preds = %20, %16
%25 = load i8*, i8** %7
%26 = load i8*, i8** %5
%27 = call i32 @sprintf(i8* %25, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* %26)
store i32 -1, i32* %4
br label %30
28: ; preds = %20
br label %29
29: ; preds = %28
store i32 0, i32* %4
br label %30
30: ; preds = %29, %24, %12
%31 = load i32, i32* %4
ret i32 %31
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [35 x i8] c"Transpose: integer expected : '%s'\00"
@.str.2 = [40 x i8] c"Transpose: argument out of range : '%s'\00"
define i32 @parseTranspose(i8* %0, i32* %1, i8* nocapture writeonly %2) {
%4 = tail call i64 @sscanf(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%5 = icmp eq i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %3
%7 = load i32, i32* %1
%8 = add i32 %7, -128
%9 = icmp ult i32 %8, -255
br i1 %9, label %10, label %13
10: ; preds = %6, %3
%11 = phi i8* [ getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), %3 ], [ getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), %6 ]
%12 = tail call i32 @sprintf(i8* dereferenceable(1) %2, i8* dereferenceable(1) %11, i8* %0)
br label %13
13: ; preds = %10, %6
%14 = phi i32 [ 0, %6 ], [ -1, %10 ]
ret i32 %14
}