#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 PAPI_library_init(int);
char *PAPI_strerror(int);
int /*<<< orphan*/ printf(char *, ...);
int PAPI_Errors(void) {
  int i;
  char *errorStr;
  if (PAPI_library_init(
          ((((4) << 24) | ((9) << 16) | ((0) << 8) | (0)) & 0xffff0000)) !=
      ((((4) << 24) | ((9) << 16) | ((0) << 8) | (0)) & 0xffff0000))
    return (1);
  printf("International Error String Test\n");
  printf("---------------------------------------------------------------------"
         "----\n");
  for (i = 1; i < 25; i++) {
    errorStr = PAPI_strerror(-i);
    printf("%s\n", errorStr);
  }
  printf("\n");
  return (0);
}


x86 assembly (clang, -O0):
<PAPI_Errors>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4090000,%edi
call   1030 <PAPI_library_init@plt>
cmp    $0x4090000,%eax
je     1159 <PAPI_Errors+0x29>
movl   $0x1,-0x4(%rbp)
jmp    11c9 <PAPI_Errors+0x99>
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0x19,-0x8(%rbp)
jge    11b4 <PAPI_Errors+0x84>
xor    %edi,%edi
sub    -0x8(%rbp),%edi
call   1050 <PAPI_strerror@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    117c <PAPI_Errors+0x4c>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PAPI_Errors>:
push   %rax
mov    $0x4090000,%edi
call   1050 <PAPI_library_init@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    $0x4090000,%ecx
jne    1332 <PAPI_Errors+0x1f2>
lea    0xe9b(%rip),%rdi
call   1040 <puts@plt>
lea    0xeaf(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%edi
call   1060 <PAPI_strerror@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    $0xfffffffe,%edi
call   1060 <PAPI_strerror@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    $0xfffffffd,%edi
call   1060 <PAPI_strerror@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    $0xfffffffc,%edi
call   1060 <PAPI_strerror@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    $0xfffffffb,%edi
call   1060 <PAPI_strerror@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    $0xfffffffa,%edi
call   1060 <PAPI_strerror@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    $0xfffffff9,%edi
call   1060 <PAPI_strerror@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    $0xfffffff8,%edi
call   1060 <PAPI_strerror@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    $0xfffffff7,%edi
call   1060 <PAPI_strerror@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    $0xfffffff6,%edi
call   1060 <PAPI_strerror@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    $0xfffffff5,%edi
call   1060 <PAPI_strerror@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    $0xfffffff4,%edi
call   1060 <PAPI_strerror@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    $0xfffffff3,%edi
call   1060 <PAPI_strerror@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    $0xfffffff2,%edi
call   1060 <PAPI_strerror@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    $0xfffffff1,%edi
call   1060 <PAPI_strerror@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    $0xfffffff0,%edi
call   1060 <PAPI_strerror@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    $0xffffffef,%edi
call   1060 <PAPI_strerror@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    $0xffffffee,%edi
call   1060 <PAPI_strerror@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    $0xffffffed,%edi
call   1060 <PAPI_strerror@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    $0xffffffec,%edi
call   1060 <PAPI_strerror@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    $0xffffffeb,%edi
call   1060 <PAPI_strerror@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    $0xffffffea,%edi
call   1060 <PAPI_strerror@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    $0xffffffe9,%edi
call   1060 <PAPI_strerror@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    $0xffffffe8,%edi
call   1060 <PAPI_strerror@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"International Error String Test\0A\00"
@.str.1 = [75 x i8] c"-------------------------------------------------------------------------\0A\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @PAPI_Errors() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = call i32 @PAPI_library_init(i32 67698688)
%5 = icmp ne i32 %4, 67698688
br i1 %5, label %6, label %7
6: ; preds = %0
store i32 1, i32* %1
br label %24
7: ; preds = %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %2
br label %10
10: ; preds = %19, %7
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 25
br i1 %12, label %13, label %22
13: ; preds = %10
%14 = load i32, i32* %2
%15 = sub nsw i32 0, %14
%16 = call i8* @PAPI_strerror(i32 %15)
store i8* %16, i8** %3
%17 = load i8*, i8** %3
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %17)
br label %19
19: ; preds = %13
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
store i32 %21, i32* %2
br label %10
22: ; preds = %10
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %1
br label %24
24: ; preds = %22, %6
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
@str = [32 x i8] c"International Error String Test\00"
@str.4 = [74 x i8] c"-------------------------------------------------------------------------\00"
define i32 @PAPI_Errors() {
%1 = tail call i32 @PAPI_library_init(i32 67698688)
%2 = icmp eq i32 %1, 67698688
br i1 %2, label %3, label %55
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @str.4, i64 0, i64 0))
%6 = tail call i8* @PAPI_strerror(i32 -1)
%7 = tail call i32 @puts(i8* dereferenceable(1) %6)
%8 = tail call i8* @PAPI_strerror(i32 -2)
%9 = tail call i32 @puts(i8* dereferenceable(1) %8)
%10 = tail call i8* @PAPI_strerror(i32 -3)
%11 = tail call i32 @puts(i8* dereferenceable(1) %10)
%12 = tail call i8* @PAPI_strerror(i32 -4)
%13 = tail call i32 @puts(i8* dereferenceable(1) %12)
%14 = tail call i8* @PAPI_strerror(i32 -5)
%15 = tail call i32 @puts(i8* dereferenceable(1) %14)
%16 = tail call i8* @PAPI_strerror(i32 -6)
%17 = tail call i32 @puts(i8* dereferenceable(1) %16)
%18 = tail call i8* @PAPI_strerror(i32 -7)
%19 = tail call i32 @puts(i8* dereferenceable(1) %18)
%20 = tail call i8* @PAPI_strerror(i32 -8)
%21 = tail call i32 @puts(i8* dereferenceable(1) %20)
%22 = tail call i8* @PAPI_strerror(i32 -9)
%23 = tail call i32 @puts(i8* dereferenceable(1) %22)
%24 = tail call i8* @PAPI_strerror(i32 -10)
%25 = tail call i32 @puts(i8* dereferenceable(1) %24)
%26 = tail call i8* @PAPI_strerror(i32 -11)
%27 = tail call i32 @puts(i8* dereferenceable(1) %26)
%28 = tail call i8* @PAPI_strerror(i32 -12)
%29 = tail call i32 @puts(i8* dereferenceable(1) %28)
%30 = tail call i8* @PAPI_strerror(i32 -13)
%31 = tail call i32 @puts(i8* dereferenceable(1) %30)
%32 = tail call i8* @PAPI_strerror(i32 -14)
%33 = tail call i32 @puts(i8* dereferenceable(1) %32)
%34 = tail call i8* @PAPI_strerror(i32 -15)
%35 = tail call i32 @puts(i8* dereferenceable(1) %34)
%36 = tail call i8* @PAPI_strerror(i32 -16)
%37 = tail call i32 @puts(i8* dereferenceable(1) %36)
%38 = tail call i8* @PAPI_strerror(i32 -17)
%39 = tail call i32 @puts(i8* dereferenceable(1) %38)
%40 = tail call i8* @PAPI_strerror(i32 -18)
%41 = tail call i32 @puts(i8* dereferenceable(1) %40)
%42 = tail call i8* @PAPI_strerror(i32 -19)
%43 = tail call i32 @puts(i8* dereferenceable(1) %42)
%44 = tail call i8* @PAPI_strerror(i32 -20)
%45 = tail call i32 @puts(i8* dereferenceable(1) %44)
%46 = tail call i8* @PAPI_strerror(i32 -21)
%47 = tail call i32 @puts(i8* dereferenceable(1) %46)
%48 = tail call i8* @PAPI_strerror(i32 -22)
%49 = tail call i32 @puts(i8* dereferenceable(1) %48)
%50 = tail call i8* @PAPI_strerror(i32 -23)
%51 = tail call i32 @puts(i8* dereferenceable(1) %50)
%52 = tail call i8* @PAPI_strerror(i32 -24)
%53 = tail call i32 @puts(i8* dereferenceable(1) %52)
%54 = tail call i32 @putchar(i32 10)
br label %55
55: ; preds = %0, %3
%56 = phi i32 [ 0, %3 ], [ 1, %0 ]
ret i32 %56
}