#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*/ print_polynomial_inline(int, long *);
int /*<<< orphan*/ printf(char *, ...);
void print_solutions_incorrect(int func_degree, long func_coeffs[], long mod,
                               long exp_sol[], int num_exp_sol, long fnd_sol[],
                               int num_found_sol) {
  int i;
  printf("Incorrect solutions found for congruence ");
  print_polynomial_inline(func_degree, func_coeffs);
  printf(" = 0 (mod %d): %d given where %d expected.\n\n", mod, num_found_sol,
         num_exp_sol);
  printf("The following solutions were found: \n");
  for (i = 0; i < num_found_sol; i++) {
    printf("(%d) %d\n", i, fnd_sol[i]);
  }
  printf("\nwhere the actual solutions are\n\n");
  for (i = 0; i < num_exp_sol; i++) {
    printf("(%d) %d\n", i, exp_sol[i]);
  }
}


x86 assembly (clang, -O0):
<print_solutions_incorrect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9,-0x30(%rbp)
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <print_polynomial_inline@plt>
mov    -0x18(%rbp),%rsi
mov    0x10(%rbp),%edx
mov    -0x24(%rbp),%ecx
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xedc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    0x10(%rbp),%eax
jge    11c0 <print_solutions_incorrect+0xa0>
mov    -0x34(%rbp),%esi
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1189 <print_solutions_incorrect+0x69>
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    120c <print_solutions_incorrect+0xec>
mov    -0x34(%rbp),%esi
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11d5 <print_solutions_incorrect+0xb5>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_solutions_incorrect>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r14
mov    %r8d,%ebp
mov    %rcx,%r12
mov    %rdx,%r13
mov    %rsi,%rbx
mov    %edi,%r15d
lea    0xeac(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
call   1040 <print_polynomial_inline@plt>
lea    0xebd(%rip),%rdi
mov    %r13,%rsi
mov    %ebp,%r13d
mov    0x40(%rsp),%edx
mov    %r13d,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    0x40(%rsp),%eax
test   %eax,%eax
jle    11b9 <print_solutions_incorrect+0x89>
mov    %eax,%ebp
lea    0xeb9(%rip),%r15
xor    %ebx,%ebx
mov    (%r14,%rbx,8),%rdx
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    11a0 <print_solutions_incorrect+0x70>
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
test   %r13d,%r13d
jle    11f9 <print_solutions_incorrect+0xc9>
mov    %r13d,%ebx
lea    0xe83(%rip),%r14
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    (%r12,%rbp,8),%rdx
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    11e0 <print_solutions_incorrect+0xb0>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"Incorrect solutions found for congruence \00"
@.str.1 = [45 x i8] c" = 0 (mod %d): %d given where %d expected.\0A\0A\00"
@.str.2 = [38 x i8] c"The following solutions were found: \0A\00"
@.str.3 = [9 x i8] c"(%d) %d\0A\00"
@.str.4 = [34 x i8] c"\0Awhere the actual solutions are\0A\0A\00"
define void @print_solutions_incorrect(i32 %0, i64* %1, i64 %2, i64* %3, i32 %4, i64* %5, i32 %6) {
%8 = alloca i32
%9 = alloca i64*
%10 = alloca i64
%11 = alloca i64*
%12 = alloca i32
%13 = alloca i64*
%14 = alloca i32
%15 = alloca i32
store i32 %0, i32* %8
store i64* %1, i64** %9
store i64 %2, i64* %10
store i64* %3, i64** %11
store i32 %4, i32* %12
store i64* %5, i64** %13
store i32 %6, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%17 = load i32, i32* %8
%18 = load i64*, i64** %9
%19 = call i32 @print_polynomial_inline(i32 %17, i64* %18)
%20 = load i64, i64* %10
%21 = load i32, i32* %14
%22 = load i32, i32* %12
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i64 %20, i32 %21, i32 %22)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %15
br label %25
25: ; preds = %37, %7
%26 = load i32, i32* %15
%27 = load i32, i32* %14
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %40
29: ; preds = %25
%30 = load i32, i32* %15
%31 = load i64*, i64** %13
%32 = load i32, i32* %15
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i64, i64* %31, i64 %33
%35 = load i64, i64* %34
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %30, i64 %35)
br label %37
37: ; preds = %29
%38 = load i32, i32* %15
%39 = add nsw i32 %38, 1
store i32 %39, i32* %15
br label %25
40: ; preds = %25
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %15
br label %42
42: ; preds = %54, %40
%43 = load i32, i32* %15
%44 = load i32, i32* %12
%45 = icmp slt i32 %43, %44
br i1 %45, label %46, label %57
46: ; preds = %42
%47 = load i32, i32* %15
%48 = load i64*, i64** %11
%49 = load i32, i32* %15
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i64, i64* %48, i64 %50
%52 = load i64, i64* %51
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %47, i64 %52)
br label %54
54: ; preds = %46
%55 = load i32, i32* %15
%56 = add nsw i32 %55, 1
store i32 %56, i32* %15
br label %42
57: ; preds = %42
ret void
}

LLVM IR (-O2):
@.str = [42 x i8] c"Incorrect solutions found for congruence \00"
@.str.1 = [45 x i8] c" = 0 (mod %d): %d given where %d expected.\0A\0A\00"
@.str.3 = [9 x i8] c"(%d) %d\0A\00"
@str = [37 x i8] c"The following solutions were found: \00"
@str.5 = [33 x i8] c"\0Awhere the actual solutions are\0A\00"
define void @print_solutions_incorrect(i32 %0, i64* %1, i64 %2, i64* nocapture %3, i32 %4, i64* nocapture %5, i32 %6) {
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @print_polynomial_inline(i32 %0, i64* %1)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i64 %2, i32 %6, i32 %4)
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%12 = icmp sgt i32 %6, 0
br i1 %12, label %13, label %23
13: ; preds = %7
%14 = zext i32 %6 to i64
br label %15
15: ; preds = %13, %15
%16 = phi i64 [ 0, %13 ], [ %21, %15 ]
%17 = getelementptr inbounds i64, i64* %5, i64 %16
%18 = load i64, i64* %17
%19 = trunc i64 %16 to i32
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %19, i64 %18)
%21 = add nuw nsw i64 %16, 1
%22 = icmp eq i64 %21, %14
br i1 %22, label %23, label %15
23: ; preds = %15, %7
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.5, i64 0, i64 0))
%25 = icmp sgt i32 %4, 0
br i1 %25, label %26, label %36
26: ; preds = %23
%27 = zext i32 %4 to i64
br label %28
28: ; preds = %26, %28
%29 = phi i64 [ 0, %26 ], [ %34, %28 ]
%30 = getelementptr inbounds i64, i64* %3, i64 %29
%31 = load i64, i64* %30
%32 = trunc i64 %29 to i32
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %32, i64 %31)
%34 = add nuw nsw i64 %29, 1
%35 = icmp eq i64 %34, %27
br i1 %35, label %36, label %28
36: ; preds = %28, %23
ret void
}