#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 f2(int, int *, int *);
int f2t(int, int *, int *);
int /*<<< orphan*/ printf(char *, ...);
int rand();
int main() {
  int a[20];
  int b[20];
  int i, j, n;
  for (i = 0; i < 10; i++) {
    n = rand() % 20 + 1;
    for (j = 0; j < n; j++) {
      a[j] = rand() % 10;
      b[j] = rand() % 10;
    }
    int stud = f2(n, a, b);
    int teac = f2t(n, a, b);
    if (stud != teac) {
      printf("a[0]=%d, b[0]=%d\n", a[0], b[0]);
      printf("Hiba: stud=%d, teac=%d\n", stud, teac);
    } else {
      printf("OK\n");
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xb4(%rbp)
cmpl   $0xa,-0xb4(%rbp)
jge    128f <main+0x14f>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x14,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0xbc(%rbp)
movl   $0x0,-0xb8(%rbp)
mov    -0xb8(%rbp),%eax
cmp    -0xbc(%rbp),%eax
jge    11e8 <main+0xa8>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
movslq -0xb8(%rbp),%rax
mov    %edx,-0x60(%rbp,%rax,4)
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
movslq -0xb8(%rbp),%rax
mov    %edx,-0xb0(%rbp,%rax,4)
mov    -0xb8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb8(%rbp)
jmp    118b <main+0x4b>
mov    -0xbc(%rbp),%edi
lea    -0x60(%rbp),%rsi
lea    -0xb0(%rbp),%rdx
call   1030 <f2@plt>
mov    %eax,-0xc0(%rbp)
mov    -0xbc(%rbp),%edi
lea    -0x60(%rbp),%rsi
lea    -0xb0(%rbp),%rdx
call   1050 <f2t@plt>
mov    %eax,-0xc4(%rbp)
mov    -0xc0(%rbp),%eax
cmp    -0xc4(%rbp),%eax
je     1268 <main+0x128>
mov    -0x60(%rbp),%esi
mov    -0xb0(%rbp),%edx
lea    0xdbe(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc0(%rbp),%esi
mov    -0xc4(%rbp),%edx
lea    0xdb6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1276 <main+0x136>
lea    0xdbb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    127b <main+0x13b>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    115c <main+0x1c>
mov    -0x4(%rbp),%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    %rsp,%r13
xor    %r12d,%r12d
jmp    118a <main+0x3a>
nopl   0x0(%rax)
lea    0xeb3(%rip),%rdi
call   1040 <puts@plt>
add    $0x1,%r12d
cmp    $0xa,%r12d
je     1284 <main+0x134>
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
mov    %eax,%edx
sub    %ecx,%edx
neg    %ecx
lea    (%rax,%rcx,1),%r14d
add    $0x1,%r14d
test   %edx,%edx
js     1228 <main+0xd8>
mov    %r14d,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    %eax,0x50(%rsp,%rbp,4)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    %eax,(%rsp,%rbp,4)
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    11d0 <main+0x80>
mov    %r14d,%edi
lea    0x50(%rsp),%rbx
mov    %rbx,%rsi
mov    %r13,%rdx
call   1030 <f2@plt>
mov    %eax,%r15d
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %r13,%rdx
call   1060 <f2t@plt>
cmp    %eax,%r15d
je     1170 <main+0x20>
mov    %eax,%ebp
mov    0x50(%rsp),%esi
mov    (%rsp),%edx
lea    0xd9b(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd9f(%rip),%rdi
mov    %r15d,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    117c <main+0x2c>
xor    %eax,%eax
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"a[0]=%d, b[0]=%d\0A\00"
@.str.1 = [24 x i8] c"Hiba: stud=%d, teac=%d\0A\00"
@.str.2 = [4 x i8] c"OK\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i32]
%3 = alloca [20 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
br label %9
9: ; preds = %58, %0
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 10
br i1 %11, label %12, label %61
12: ; preds = %9
%13 = call i32 (...) @rand()
%14 = srem i32 %13, 20
%15 = add nsw i32 %14, 1
store i32 %15, i32* %6
store i32 0, i32* %5
br label %16
16: ; preds = %31, %12
%17 = load i32, i32* %5
%18 = load i32, i32* %6
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %34
20: ; preds = %16
%21 = call i32 (...) @rand()
%22 = srem i32 %21, 10
%23 = load i32, i32* %5
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 %24
store i32 %22, i32* %25
%26 = call i32 (...) @rand()
%27 = srem i32 %26, 10
%28 = load i32, i32* %5
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %29
store i32 %27, i32* %30
br label %31
31: ; preds = %20
%32 = load i32, i32* %5
%33 = add nsw i32 %32, 1
store i32 %33, i32* %5
br label %16
34: ; preds = %16
%35 = load i32, i32* %6
%36 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%37 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 0
%38 = call i32 @f2(i32 %35, i32* %36, i32* %37)
store i32 %38, i32* %7
%39 = load i32, i32* %6
%40 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%41 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 0
%42 = call i32 @f2t(i32 %39, i32* %40, i32* %41)
store i32 %42, i32* %8
%43 = load i32, i32* %7
%44 = load i32, i32* %8
%45 = icmp ne i32 %43, %44
br i1 %45, label %46, label %55
46: ; preds = %34
%47 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%48 = load i32, i32* %47
%49 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 0
%50 = load i32, i32* %49
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %48, i32 %50)
%52 = load i32, i32* %7
%53 = load i32, i32* %8
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %52, i32 %53)
br label %57
55: ; preds = %34
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %57
57: ; preds = %55, %46
br label %58
58: ; preds = %57
%59 = load i32, i32* %4
%60 = add nsw i32 %59, 1
store i32 %60, i32* %4
br label %9
61: ; preds = %9
%62 = load i32, i32* %1
ret i32 %62
}

LLVM IR (-O2):
@.str = [18 x i8] c"a[0]=%d, b[0]=%d\0A\00"
@.str.1 = [24 x i8] c"Hiba: stud=%d, teac=%d\0A\00"
@str = [3 x i8] c"OK\00"
define i32 @main() {
%1 = alloca [20 x i32]
%2 = alloca [20 x i32]
%3 = bitcast [20 x i32]* %1 to i8*
%4 = bitcast [20 x i32]* %2 to i8*
%5 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 0
%6 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
br label %7
7: ; preds = %0, %36
%8 = phi i32 [ 0, %0 ], [ %37, %36 ]
%9 = call i32 (...) @rand()
%10 = srem i32 %9, 20
%11 = add nsw i32 %10, 1
%12 = icmp slt i32 %10, 0
br i1 %12, label %25, label %13
13: ; preds = %7
%14 = zext i32 %11 to i64
br label %15
15: ; preds = %13, %15
%16 = phi i64 [ 0, %13 ], [ %23, %15 ]
%17 = call i32 (...) @rand()
%18 = srem i32 %17, 10
%19 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 %16
store i32 %18, i32* %19
%20 = call i32 (...) @rand()
%21 = srem i32 %20, 10
%22 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 %16
store i32 %21, i32* %22
%23 = add nuw nsw i64 %16, 1
%24 = icmp eq i64 %23, %14
br i1 %24, label %25, label %15
25: ; preds = %15, %7
%26 = call i32 @f2(i32 %11, i32* %5, i32* %6)
%27 = call i32 @f2t(i32 %11, i32* %5, i32* %6)
%28 = icmp eq i32 %26, %27
br i1 %28, label %34, label %29
29: ; preds = %25
%30 = load i32, i32* %5
%31 = load i32, i32* %6
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %30, i32 %31)
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %26, i32 %27)
br label %36
34: ; preds = %25
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
br label %36
36: ; preds = %34, %29
%37 = add nuw nsw i32 %8, 1
%38 = icmp eq i32 %37, 10
br i1 %38, label %39, label %7
39: ; preds = %36
ret i32 0
}