#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*/ printf(char *, ...);
char *sf_error_number(int);
scalar_t__ strstr(char const *, char *);
int main(void) {
  const char *noerror, *errstr;
  int k;
  noerror = sf_error_number(0);
  printf("Testing to see if all internal error numbers have corresponding "
         "error messages :\n");
  for (k = 1; k < 1000; k++) {
    errstr = sf_error_number(k);
    printf("%6d : %s\n", k, errstr);
    if (errstr == noerror)
      break;
    if (strstr(errstr, "This is a bug in libsndfile."))
      return 1;
  };
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1030 <sf_error_number@plt>
mov    %rax,-0x10(%rbp)
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x1c(%rbp)
cmpl   $0x3e8,-0x1c(%rbp)
jge    11d9 <main+0xa9>
mov    -0x1c(%rbp),%edi
call   1030 <sf_error_number@plt>
mov    %rax,-0x18(%rbp)
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%rdx
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    11a0 <main+0x70>
jmp    11d9 <main+0xa9>
mov    -0x18(%rbp),%rdi
lea    0xeb1(%rip),%rsi
call   1050 <strstr@plt>
cmp    $0x0,%rax
je     11c6 <main+0x96>
movl   $0x1,-0x4(%rbp)
jmp    11e0 <main+0xb0>
jmp    11cb <main+0x9b>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    115f <main+0x2f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %r14d,%r14d
xor    %edi,%edi
call   1040 <sf_error_number@plt>
mov    %rax,%r13
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebp
lea    0xe90(%rip),%r15
lea    0xe93(%rip),%r12
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1040 <sf_error_number@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %ebp,%esi
mov    %rax,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %r13,%rbx
je     11c1 <main+0x81>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1060 <strstr@plt>
test   %rax,%rax
jne    11bb <main+0x7b>
add    $0x1,%ebp
cmp    $0x3e8,%ebp
jne    1180 <main+0x40>
jmp    11c1 <main+0x81>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [82 x i8] c"Testing to see if all internal error numbers have corresponding error messages :\0A\00"
@.str.1 = [10 x i8] c"%6d : %s\0A\00"
@.str.2 = [29 x i8] c"This is a bug in libsndfile.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i32 0, i32* %1
%5 = call i8* @sf_error_number(i32 0)
store i8* %5, i8** %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %4
br label %7
7: ; preds = %26, %0
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 1000
br i1 %9, label %10, label %29
10: ; preds = %7
%11 = load i32, i32* %4
%12 = call i8* @sf_error_number(i32 %11)
store i8* %12, i8** %3
%13 = load i32, i32* %4
%14 = load i8*, i8** %3
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %13, i8* %14)
%16 = load i8*, i8** %3
%17 = load i8*, i8** %2
%18 = icmp eq i8* %16, %17
br i1 %18, label %19, label %20
19: ; preds = %10
br label %29
20: ; preds = %10
%21 = load i8*, i8** %3
%22 = call i64 @strstr(i8* %21, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %20
store i32 1, i32* %1
br label %30
25: ; preds = %20
br label %26
26: ; preds = %25
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
br label %7
29: ; preds = %19, %7
store i32 0, i32* %1
br label %30
30: ; preds = %29, %24
%31 = load i32, i32* %1
ret i32 %31
}

LLVM IR (-O2):
@.str.1 = [10 x i8] c"%6d : %s\0A\00"
@.str.2 = [29 x i8] c"This is a bug in libsndfile.\00"
@str = [81 x i8] c"Testing to see if all internal error numbers have corresponding error messages :\00"
define i32 @main() {
%1 = tail call i8* @sf_error_number(i32 0)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @str, i64 0, i64 0))
br label %6
3: ; preds = %11
%4 = add nuw nsw i32 %7, 1
%5 = icmp eq i32 %4, 1000
br i1 %5, label %14, label %6
6: ; preds = %0, %3
%7 = phi i32 [ 1, %0 ], [ %4, %3 ]
%8 = tail call i8* @sf_error_number(i32 %7)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %7, i8* %8)
%10 = icmp eq i8* %8, %1
br i1 %10, label %14, label %11
11: ; preds = %6
%12 = tail call i64 @strstr(i8* %8, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %3, label %14
14: ; preds = %3, %6, %11
%15 = phi i32 [ 1, %11 ], [ 0, %6 ], [ 0, %3 ]
ret i32 %15
}