#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 *, ...);
void printArgs(int p, int q, int l, int r, int **schedule) {
  int loop;
  printf("Args: p=%d; q=%d; l=%d; r=%d;\n", p, q, l, r);
  printf("LittleZ:\n");
  for (loop = 0; loop < p; loop++)
    printf(" %d->%d", schedule[loop][0], schedule[loop][1]);
  printf("\nLittleX:\n");
  for (loop = p; loop < (p + q); loop++)
    printf(" %d->%d", schedule[loop][0], schedule[loop][1]);
}


x86 assembly (clang, -O0):
<printArgs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    119d <printArgs+0x8d>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x4(%rax),%edx
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1158 <printArgs+0x48>
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    -0x8(%rbp),%ecx
cmp    %ecx,%eax
jge    11fb <printArgs+0xeb>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x4(%rax),%edx
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11b1 <printArgs+0xa1>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printArgs>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%r13
mov    %ecx,%r8d
mov    %edx,%ecx
mov    %esi,%r14d
mov    %edi,%r15d
lea    0xec0(%rip),%rdi
mov    %r15d,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
test   %r15d,%r15d
jle    118d <printArgs+0x6d>
mov    %r15d,%ebp
lea    0xeb7(%rip),%r12
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    0x0(%r13,%rbx,8),%rax
mov    (%rax),%esi
mov    0x4(%rax),%edx
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1170 <printArgs+0x50>
lea    0xe9c(%rip),%rdi
call   1030 <puts@plt>
test   %r14d,%r14d
jle    11cd <printArgs+0xad>
add    %r15d,%r14d
movslq %r15d,%rbp
movslq %r14d,%rbx
lea    0xe71(%rip),%r14
xchg   %ax,%ax
mov    0x0(%r13,%rbp,8),%rax
mov    (%rax),%esi
mov    0x4(%rax),%edx
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    %rbx,%rbp
jl     11b0 <printArgs+0x90>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Args: p=%d; q=%d; l=%d; r=%d;\0A\00"
@.str.1 = [10 x i8] c"LittleZ:\0A\00"
@.str.2 = [8 x i8] c" %d->%d\00"
@.str.3 = [11 x i8] c"\0ALittleX:\0A\00"
define void @printArgs(i32 %0, i32 %1, i32 %2, i32 %3, i32** %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32**
%11 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32** %4, i32*** %10
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = load i32, i32* %9
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %13, i32 %14, i32 %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %11
br label %18
18: ; preds = %38, %5
%19 = load i32, i32* %11
%20 = load i32, i32* %6
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %41
22: ; preds = %18
%23 = load i32**, i32*** %10
%24 = load i32, i32* %11
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32*, i32** %23, i64 %25
%27 = load i32*, i32** %26
%28 = getelementptr inbounds i32, i32* %27, i64 0
%29 = load i32, i32* %28
%30 = load i32**, i32*** %10
%31 = load i32, i32* %11
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32*, i32** %30, i64 %32
%34 = load i32*, i32** %33
%35 = getelementptr inbounds i32, i32* %34, i64 1
%36 = load i32, i32* %35
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %29, i32 %36)
br label %38
38: ; preds = %22
%39 = load i32, i32* %11
%40 = add nsw i32 %39, 1
store i32 %40, i32* %11
br label %18
41: ; preds = %18
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%43 = load i32, i32* %6
store i32 %43, i32* %11
br label %44
44: ; preds = %66, %41
%45 = load i32, i32* %11
%46 = load i32, i32* %6
%47 = load i32, i32* %7
%48 = add nsw i32 %46, %47
%49 = icmp slt i32 %45, %48
br i1 %49, label %50, label %69
50: ; preds = %44
%51 = load i32**, i32*** %10
%52 = load i32, i32* %11
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i32*, i32** %51, i64 %53
%55 = load i32*, i32** %54
%56 = getelementptr inbounds i32, i32* %55, i64 0
%57 = load i32, i32* %56
%58 = load i32**, i32*** %10
%59 = load i32, i32* %11
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i32*, i32** %58, i64 %60
%62 = load i32*, i32** %61
%63 = getelementptr inbounds i32, i32* %62, i64 1
%64 = load i32, i32* %63
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %57, i32 %64)
br label %66
66: ; preds = %50
%67 = load i32, i32* %11
%68 = add nsw i32 %67, 1
store i32 %68, i32* %11
br label %44
69: ; preds = %44
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"Args: p=%d; q=%d; l=%d; r=%d;\0A\00"
@.str.2 = [8 x i8] c" %d->%d\00"
@str = [9 x i8] c"LittleZ:\00"
@str.4 = [10 x i8] c"\0ALittleX:\00"
define void @printArgs(i32 %0, i32 %1, i32 %2, i32 %3, i32** nocapture %4) {
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %2, i32 %3)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%8 = icmp sgt i32 %0, 0
br i1 %8, label %9, label %21
9: ; preds = %5
%10 = zext i32 %0 to i64
br label %11
11: ; preds = %9, %11
%12 = phi i64 [ 0, %9 ], [ %19, %11 ]
%13 = getelementptr inbounds i32*, i32** %4, i64 %12
%14 = load i32*, i32** %13
%15 = load i32, i32* %14
%16 = getelementptr inbounds i32, i32* %14, i64 1
%17 = load i32, i32* %16
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %15, i32 %17)
%19 = add nuw nsw i64 %12, 1
%20 = icmp eq i64 %19, %10
br i1 %20, label %21, label %11
21: ; preds = %11, %5
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.4, i64 0, i64 0))
%23 = icmp sgt i32 %1, 0
br i1 %23, label %24, label %38
24: ; preds = %21
%25 = add nsw i32 %1, %0
%26 = sext i32 %0 to i64
%27 = sext i32 %25 to i64
br label %28
28: ; preds = %24, %28
%29 = phi i64 [ %26, %24 ], [ %36, %28 ]
%30 = getelementptr inbounds i32*, i32** %4, i64 %29
%31 = load i32*, i32** %30
%32 = load i32, i32* %31
%33 = getelementptr inbounds i32, i32* %31, i64 1
%34 = load i32, i32* %33
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %32, i32 %34)
%36 = add nsw i64 %29, 1
%37 = icmp slt i64 %36, %27
br i1 %37, label %28, label %38
38: ; preds = %28, %21
ret void
}