#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_wp(int *weight_polynomial, int dim_faktor) {
  printf("[");
  for (int i = 0; i <= 12 * dim_faktor; ++i) {
    printf(" %i", weight_polynomial[i]);
  }
  printf(" ]");
}


x86 assembly (clang, -O0):
<print_wp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
imul   $0xc,-0xc(%rbp),%ecx
cmp    %ecx,%eax
jg     116a <print_wp+0x5a>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1134 <print_wp+0x24>
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_wp>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %rdi,%r15
mov    $0x5b,%edi
call   1030 <putchar@plt>
test   %r14d,%r14d
js     1177 <print_wp+0x57>
shl    $0x2,%r14d
lea    (%r14,%r14,2),%r12d
xor    %eax,%eax
test   %r12d,%r12d
cmovle %eax,%r12d
or     $0x1,%r12d
lea    0xea7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1160 <print_wp+0x40>
lea    0xe86(%rip),%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <printf@plt>

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

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