#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*/ assert(int);
scalar_t__ nc_def_dim(int, int /*<<< orphan*/, size_t, int *);
void createtestdims(int cdfid, size_t num_dims, size_t *sizes,
                    char *dim_names[]) {
  int dimid;
  while (num_dims-- != 0) {
    assert(nc_def_dim(cdfid, *dim_names++, *sizes, &dimid) == 0);
    sizes++;
  }
}


x86 assembly (clang, -O0):
<createtestdims>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
cmp    $0x0,%rax
je     1199 <createtestdims+0x79>
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x20(%rbp)
mov    (%rax),%rax
mov    %eax,%esi
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
lea    -0x24(%rbp),%rcx
call   1040 <nc_def_dim@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
jmp    1137 <createtestdims+0x17>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createtestdims>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %rsi,%rsi
je     117a <createtestdims+0x5a>
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %edi,%r13d
xor    %ebp,%ebp
lea    0x4(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%r14,%rbp,8),%esi
mov    (%r15,%rbp,8),%rdx
mov    %r13d,%edi
mov    %r12,%rcx
call   1040 <nc_def_dim@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1030 <assert@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1150 <createtestdims+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @createtestdims(i32 %0, i64 %1, i64* nocapture %2, i8** nocapture %3) {
%5 = alloca i32
%6 = bitcast i32* %5 to i8*
%7 = icmp eq i64 %1, 0
br i1 %7, label %24, label %8
8: ; preds = %4, %8
%9 = phi i8** [ %13, %8 ], [ %3, %4 ]
%10 = phi i64* [ %22, %8 ], [ %2, %4 ]
%11 = phi i64 [ %12, %8 ], [ %1, %4 ]
%12 = add i64 %11, -1
%13 = getelementptr inbounds i8*, i8** %9, i64 1
%14 = load i8*, i8** %9
%15 = ptrtoint i8* %14 to i64
%16 = trunc i64 %15 to i32
%17 = load i64, i64* %10
%18 = call i64 @nc_def_dim(i32 %0, i32 %16, i64 %17, i32* %5)
%19 = icmp eq i64 %18, 0
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = getelementptr inbounds i64, i64* %10, i64 1
%23 = icmp eq i64 %12, 0
br i1 %23, label %24, label %8
24: ; preds = %8, %4
ret void
}