#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*/ HError(int, char *, int, int);
void ZeroStreamWidths(int numS, short *swidth) {
  int s;
  if (numS >= 5)
    HError(6372, "ZeroStreamWidths: num streams(%d) > MAX(%d)\n", numS, 5 - 1);
  swidth[0] = numS;
  for (s = 1; s <= numS; s++)
    swidth[s] = 0;
}


x86 assembly (clang, -O0):
<ZeroStreamWidths>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x5,-0x4(%rbp)
jl     1142 <ZeroStreamWidths+0x32>
mov    -0x4(%rbp),%edx
mov    $0x18e4,%edi
lea    0xec8(%rip),%rsi
mov    $0x4,%ecx
call   1030 <HError@plt>
mov    -0x4(%rbp),%eax
mov    %ax,%cx
mov    -0x10(%rbp),%rax
mov    %cx,(%rax)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     117e <ZeroStreamWidths+0x6e>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movw   $0x0,(%rax,%rcx,2)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1156 <ZeroStreamWidths+0x46>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ZeroStreamWidths>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
cmp    $0x5,%edi
jl     114a <ZeroStreamWidths+0x2a>
lea    0xecc(%rip),%rsi
mov    $0x18e4,%edi
mov    %ebp,%edx
mov    $0x4,%ecx
call   1030 <HError@plt>
mov    %bp,(%rbx)
jmp    1151 <ZeroStreamWidths+0x31>
mov    %bp,(%rbx)
test   %ebp,%ebp
jle    1164 <ZeroStreamWidths+0x44>
add    $0x2,%rbx
mov    %ebp,%edx
add    %rdx,%rdx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [45 x i8] c"ZeroStreamWidths: num streams(%d) > MAX(%d)\0A\00"
define void @ZeroStreamWidths(i32 %0, i16* nocapture writeonly %1) {
%3 = icmp sgt i32 %0, 4
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i32 @HError(i32 6372, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %0, i32 4)
%6 = trunc i32 %0 to i16
store i16 %6, i16* %1
br label %10
7: ; preds = %2
%8 = trunc i32 %0 to i16
store i16 %8, i16* %1
%9 = icmp slt i32 %0, 1
br i1 %9, label %15, label %10
10: ; preds = %4, %7
%11 = getelementptr i16, i16* %1, i64 1
%12 = bitcast i16* %11 to i8*
%13 = zext i32 %0 to i64
%14 = shl nuw nsw i64 %13, 1
br label %15
15: ; preds = %10, %7
ret void
}