#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 */
struct QMIX_STATE {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ render(struct QMIX_STATE *, short *, unsigned int);
void _qmix_render(void *state, signed short *buf, unsigned int samples) {
  for (; samples >= (200); samples -= (200)) {
    render(((struct QMIX_STATE *)(state)), buf, (200));
    if (buf)
      buf += 2 * (200);
  }
  if (samples) {
    render(((struct QMIX_STATE *)(state)), buf, samples);
  }
}


x86 assembly (clang, -O0):
<_qmix_render>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0xc8,-0x14(%rbp)
jb     1170 <_qmix_render+0x60>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0xc8,%edx
call   1030 <render@plt>
cmpq   $0x0,-0x10(%rbp)
je     115b <_qmix_render+0x4b>
mov    -0x10(%rbp),%rax
add    $0x320,%rax
mov    %rax,-0x10(%rbp)
jmp    1160 <_qmix_render+0x50>
mov    -0x14(%rbp),%eax
sub    $0xc8,%eax
mov    %eax,-0x14(%rbp)
jmp    1123 <_qmix_render+0x13>
cmpl   $0x0,-0x14(%rbp)
je     118a <_qmix_render+0x7a>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <render@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_qmix_render>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %rdi,%r14
cmp    $0xc8,%edx
jb     115c <_qmix_render+0x4c>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0xc8,%edx
call   1030 <render@plt>
lea    0x320(%rbx),%rax
test   %rbx,%rbx
cmovne %rax,%rbx
add    $0xffffff38,%ebp
cmp    $0xc7,%ebp
ja     1130 <_qmix_render+0x20>
test   %ebp,%ebp
je     1171 <_qmix_render+0x61>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <render@plt>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.QMIX_STATE = type { i32 }
define void @_qmix_render(i8* %0, i16* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i16*
%6 = alloca i32
store i8* %0, i8** %4
store i16* %1, i16** %5
store i32 %2, i32* %6
br label %7
7: ; preds = %21, %3
%8 = load i32, i32* %6
%9 = icmp uge i32 %8, 200
br i1 %9, label %10, label %24
10: ; preds = %7
%11 = load i8*, i8** %4
%12 = bitcast i8* %11 to %struct.QMIX_STATE*
%13 = load i16*, i16** %5
%14 = call i32 @render(%struct.QMIX_STATE* %12, i16* %13, i32 200)
%15 = load i16*, i16** %5
%16 = icmp ne i16* %15, null
br i1 %16, label %17, label %20
17: ; preds = %10
%18 = load i16*, i16** %5
%19 = getelementptr inbounds i16, i16* %18, i64 400
store i16* %19, i16** %5
br label %20
20: ; preds = %17, %10
br label %21
21: ; preds = %20
%22 = load i32, i32* %6
%23 = sub i32 %22, 200
store i32 %23, i32* %6
br label %7
24: ; preds = %7
%25 = load i32, i32* %6
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %33
27: ; preds = %24
%28 = load i8*, i8** %4
%29 = bitcast i8* %28 to %struct.QMIX_STATE*
%30 = load i16*, i16** %5
%31 = load i32, i32* %6
%32 = call i32 @render(%struct.QMIX_STATE* %29, i16* %30, i32 %31)
br label %33
33: ; preds = %27, %24
ret void
}

LLVM IR (-O2):
%struct.QMIX_STATE = type { i32 }
define void @_qmix_render(i8* %0, i16* %1, i32 %2) {
%4 = icmp ugt i32 %2, 199
br i1 %4, label %5, label %16
5: ; preds = %3
%6 = bitcast i8* %0 to %struct.QMIX_STATE*
br label %7
7: ; preds = %5, %7
%8 = phi i32 [ %2, %5 ], [ %14, %7 ]
%9 = phi i16* [ %1, %5 ], [ %13, %7 ]
%10 = tail call i32 @render(%struct.QMIX_STATE* %6, i16* %9, i32 200)
%11 = icmp eq i16* %9, null
%12 = getelementptr inbounds i16, i16* %9, i64 400
%13 = select i1 %11, i16* null, i16* %12
%14 = add i32 %8, -200
%15 = icmp ugt i32 %14, 199
br i1 %15, label %7, label %16
16: ; preds = %7, %3
%17 = phi i16* [ %1, %3 ], [ %13, %7 ]
%18 = phi i32 [ %2, %3 ], [ %14, %7 ]
%19 = icmp eq i32 %18, 0
br i1 %19, label %23, label %20
20: ; preds = %16
%21 = bitcast i8* %0 to %struct.QMIX_STATE*
%22 = tail call i32 @render(%struct.QMIX_STATE* %21, i16* %17, i32 %18)
br label %23
23: ; preds = %20, %16
ret void
}