#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 print(int tab[], unsigned n) {
  int i;
  for (i = 0; i < n; i++) {
    if (i == n / 2)
      printf("--\n");
    printf("i %3d tab %3d\n", i, tab[i]);
  }
}


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    117b <print+0x6b>
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
shr    $0x1,%ecx
cmp    %ecx,%eax
jne    1151 <print+0x41>
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
je     1178 <print+0x58>
mov    %esi,%r13d
mov    %rdi,%r14
mov    %esi,%ebp
shr    %r13d
lea    0xece(%rip),%r15
lea    0xeb8(%rip),%r12
xor    %ebx,%ebx
jmp    1169 <print+0x49>
nopl   0x0(%rax)
mov    (%r14,%rbx,4),%edx
mov    %r12,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
je     1178 <print+0x58>
cmp    %rbx,%r13
jne    1150 <print+0x30>
mov    %r15,%rdi
call   1030 <puts@plt>
jmp    1150 <print+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"--\0A\00"
@.str.1 = [15 x i8] c"i %3d tab %3d\0A\00"
define void @print(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %25, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp ult i32 %7, %8
br i1 %9, label %10, label %28
10: ; preds = %6
%11 = load i32, i32* %5
%12 = load i32, i32* %4
%13 = udiv i32 %12, 2
%14 = icmp eq i32 %11, %13
br i1 %14, label %15, label %17
15: ; preds = %10
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %15, %10
%18 = load i32, i32* %5
%19 = load i32*, i32** %3
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %19, i64 %21
%23 = load i32, i32* %22
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %18, i32 %23)
br label %25
25: ; preds = %17
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %6
28: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str.1 = [15 x i8] c"i %3d tab %3d\0A\00"
@str = [3 x i8] c"--\00"
define void @print(i32* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %20, label %4
4: ; preds = %2
%5 = lshr i32 %1, 1
%6 = zext i32 %5 to i64
%7 = zext i32 %1 to i64
br label %8
8: ; preds = %4, %13
%9 = phi i64 [ 0, %4 ], [ %18, %13 ]
%10 = icmp eq i64 %9, %6
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
br label %13
13: ; preds = %11, %8
%14 = getelementptr inbounds i32, i32* %0, i64 %9
%15 = load i32, i32* %14
%16 = trunc i64 %9 to i32
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %16, i32 %15)
%18 = add nuw nsw i64 %9, 1
%19 = icmp eq i64 %18, %7
br i1 %19, label %20, label %8
20: ; preds = %13, %2
ret void
}