#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 define_output_file();
int extrinsic_top_diagonal_dimension(int, int, int, int, int *);
int /*<<< orphan*/ printf(char *, ...);
int read_a_witness_set(int, int *, int *, int *);
int read_two_witness_sets(int *n1, int *n2, int *dim1, int *dim2, int *deg1,
                          int *deg2, int *cd) {
  int fail;
  printf("\n");
  fail = read_a_witness_set(1, n1, dim1, deg1);
  printf("  n = %d  dimension = %d  degree = %d\n", *n1, *dim1, *deg1);
  printf("\n");
  fail = read_a_witness_set(2, n2, dim2, deg2);
  printf("  n = %d  dimension = %d  degree = %d\n", *n2, *dim2, *deg2);
  fail = define_output_file();
  fail = extrinsic_top_diagonal_dimension(*n1, *n2, *dim1, *dim2, cd);
  printf("The top dimension of the extrinsic diagonal cascade : %d.\n", *cd);
  return fail;
}


x86 assembly (clang, -O0):
<read_two_witness_sets>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
lea    0xef5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    $0x1,%edi
call   1060 <read_a_witness_set@plt>
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
mov    -0x28(%rbp),%rax
mov    (%rax),%ecx
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    $0x2,%edi
call   1060 <read_a_witness_set@plt>
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
mov    -0x30(%rbp),%rax
mov    (%rax),%ecx
lea    0xe15(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <define_output_file@plt>
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
mov    0x10(%rbp),%r8
call   1050 <extrinsic_top_diagonal_dimension@plt>
mov    %eax,-0x34(%rbp)
mov    0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xdfa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_two_witness_sets>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%rbp
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rsi,%r13
mov    %rdi,%rbx
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r14,%rcx
call   1070 <read_a_witness_set@plt>
mov    (%rbx),%esi
mov    (%r12),%edx
mov    (%r14),%ecx
lea    0xe66(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x2,%edi
mov    %r13,%rsi
mov    %r15,%rdx
mov    %rbp,%rcx
call   1070 <read_a_witness_set@plt>
mov    0x0(%r13),%esi
mov    (%r15),%edx
mov    0x0(%rbp),%ecx
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <define_output_file@plt>
mov    (%rbx),%edi
mov    0x0(%r13),%esi
mov    (%r12),%edx
mov    (%r15),%ecx
mov    0x40(%rsp),%rbp
mov    %rbp,%r8
call   1060 <extrinsic_top_diagonal_dimension@plt>
mov    %eax,%ebx
mov    0x0(%rbp),%esi
lea    0xe25(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [39 x i8] c" n = %d dimension = %d degree = %d\0A\00"
@.str.2 = [59 x i8] c"The top dimension of the extrinsic diagonal cascade : %d.\0A\00"
define i32 @read_two_witness_sets(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6) {
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32
store i32* %0, i32** %8
store i32* %1, i32** %9
store i32* %2, i32** %10
store i32* %3, i32** %11
store i32* %4, i32** %12
store i32* %5, i32** %13
store i32* %6, i32** %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%17 = load i32*, i32** %8
%18 = load i32*, i32** %10
%19 = load i32*, i32** %12
%20 = call i32 @read_a_witness_set(i32 1, i32* %17, i32* %18, i32* %19)
store i32 %20, i32* %15
%21 = load i32*, i32** %8
%22 = load i32, i32* %21
%23 = load i32*, i32** %10
%24 = load i32, i32* %23
%25 = load i32*, i32** %12
%26 = load i32, i32* %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 %22, i32 %24, i32 %26)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%29 = load i32*, i32** %9
%30 = load i32*, i32** %11
%31 = load i32*, i32** %13
%32 = call i32 @read_a_witness_set(i32 2, i32* %29, i32* %30, i32* %31)
store i32 %32, i32* %15
%33 = load i32*, i32** %9
%34 = load i32, i32* %33
%35 = load i32*, i32** %11
%36 = load i32, i32* %35
%37 = load i32*, i32** %13
%38 = load i32, i32* %37
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 %34, i32 %36, i32 %38)
%40 = call i32 (...) @define_output_file()
store i32 %40, i32* %15
%41 = load i32*, i32** %8
%42 = load i32, i32* %41
%43 = load i32*, i32** %9
%44 = load i32, i32* %43
%45 = load i32*, i32** %10
%46 = load i32, i32* %45
%47 = load i32*, i32** %11
%48 = load i32, i32* %47
%49 = load i32*, i32** %14
%50 = call i32 @extrinsic_top_diagonal_dimension(i32 %42, i32 %44, i32 %46, i32 %48, i32* %49)
store i32 %50, i32* %15
%51 = load i32*, i32** %14
%52 = load i32, i32* %51
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0), i32 %52)
%54 = load i32, i32* %15
ret i32 %54
}

LLVM IR (-O2):
@.str.1 = [39 x i8] c" n = %d dimension = %d degree = %d\0A\00"
@.str.2 = [59 x i8] c"The top dimension of the extrinsic diagonal cascade : %d.\0A\00"
define i32 @read_two_witness_sets(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6) {
%8 = tail call i32 @putchar(i32 10)
%9 = tail call i32 @read_a_witness_set(i32 1, i32* %0, i32* %2, i32* %4)
%10 = load i32, i32* %0
%11 = load i32, i32* %2
%12 = load i32, i32* %4
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 %10, i32 %11, i32 %12)
%14 = tail call i32 @putchar(i32 10)
%15 = tail call i32 @read_a_witness_set(i32 2, i32* %1, i32* %3, i32* %5)
%16 = load i32, i32* %1
%17 = load i32, i32* %3
%18 = load i32, i32* %5
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 %16, i32 %17, i32 %18)
%20 = tail call i32 (...) @define_output_file()
%21 = load i32, i32* %0
%22 = load i32, i32* %1
%23 = load i32, i32* %2
%24 = load i32, i32* %3
%25 = tail call i32 @extrinsic_top_diagonal_dimension(i32 %21, i32 %22, i32 %23, i32 %24, i32* %6)
%26 = load i32, i32* %6
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0), i32 %26)
ret i32 %25
}