#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
long scale(long);
int /*<<< orphan*/ writearr(long *, int, int /*<<< orphan*/ *);
void writesarr(long *what, int len, FILE *out) {
  register long *p;
  int i;
  p = what;
  i = len;
  while (i) {
    *p = scale(*p);
    (void)scale(*p);
    p++;
    i--;
  }
  writearr(what, len, out);
}


x86 assembly (clang, -O0):
<writesarr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1187 <writesarr+0x67>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
call   1040 <scale@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
call   1040 <scale@plt>
mov    -0x20(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x20(%rbp)
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    1141 <writesarr+0x21>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <writearr@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writesarr>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%r14
mov    %esi,%r15d
mov    %rdi,%rbx
test   %esi,%esi
je     115e <writesarr+0x3e>
mov    %r15d,%r12d
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    (%rbx,%rbp,8),%rdi
call   1040 <scale@plt>
mov    %rax,(%rbx,%rbp,8)
mov    %rax,%rdi
call   1040 <scale@plt>
add    $0x1,%rbp
cmp    %ebp,%r12d
jne    1140 <writesarr+0x20>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r14,%rdx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <writearr@plt>

LLVM IR (-O0):
define void @writesarr(i64* %0, i32 %1, i32* %2) {
%4 = alloca i64*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i64*
%8 = alloca i32
store i64* %0, i64** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%9 = load i64*, i64** %4
store i64* %9, i64** %7
%10 = load i32, i32* %5
store i32 %10, i32* %8
br label %11
11: ; preds = %14, %3
%12 = load i32, i32* %8
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %26
14: ; preds = %11
%15 = load i64*, i64** %7
%16 = load i64, i64* %15
%17 = call i64 @scale(i64 %16)
%18 = load i64*, i64** %7
store i64 %17, i64* %18
%19 = load i64*, i64** %7
%20 = load i64, i64* %19
%21 = call i64 @scale(i64 %20)
%22 = load i64*, i64** %7
%23 = getelementptr inbounds i64, i64* %22, i32 1
store i64* %23, i64** %7
%24 = load i32, i32* %8
%25 = add nsw i32 %24, -1
store i32 %25, i32* %8
br label %11
26: ; preds = %11
%27 = load i64*, i64** %4
%28 = load i32, i32* %5
%29 = load i32*, i32** %6
%30 = call i32 @writearr(i64* %27, i32 %28, i32* %29)
ret void
}

LLVM IR (-O2):
define void @writesarr(i64* %0, i32 %1, i32* %2) {
%4 = icmp eq i32 %1, 0
br i1 %4, label %14, label %5
5: ; preds = %3, %5
%6 = phi i32 [ %12, %5 ], [ %1, %3 ]
%7 = phi i64* [ %11, %5 ], [ %0, %3 ]
%8 = load i64, i64* %7
%9 = tail call i64 @scale(i64 %8)
store i64 %9, i64* %7
%10 = tail call i64 @scale(i64 %9)
%11 = getelementptr inbounds i64, i64* %7, i64 1
%12 = add nsw i32 %6, -1
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %5
14: ; preds = %5, %3
%15 = tail call i32 @writearr(i64* %0, i32 %1, i32* %2)
ret void
}