#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 */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, int);
int /*<<< orphan*/ gen_bound(int /*<<< orphan*/ *, char *, int, int);
void gen_bounds_setup(FILE *outfile, char *regname, int numdims) {
  int i;
  for (i = 0; i < numdims; i++) {
    gen_bound(outfile, regname, i, 0);
    fprintf(outfile, " = _REG_MYLO(%s, %d);\n", regname, i);
    gen_bound(outfile, regname, i, 1);
    fprintf(outfile, " = _REG_MYHI(%s, %d);\n", regname, i);
  }
}


x86 assembly (clang, -O0):
<gen_bounds_setup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11a9 <gen_bounds_setup+0x89>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%edx
xor    %ecx,%ecx
call   1030 <gen_bound@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%ecx
lea    0xe96(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%edx
mov    $0x1,%ecx
call   1030 <gen_bound@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%ecx
lea    0xe81(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    113a <gen_bounds_setup+0x1a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_bounds_setup>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edx,%edx
jle    1199 <gen_bounds_setup+0x79>
mov    %edx,%r14d
mov    %rsi,%r15
mov    %rdi,%rbp
xor    %ebx,%ebx
lea    0xebf(%rip),%r12
lea    0xecf(%rip),%r13
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
xor    %ecx,%ecx
call   1030 <gen_bound@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %ebx,%ecx
call   1040 <fprintf@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
mov    $0x1,%ecx
call   1030 <gen_bound@plt>
mov    %rbp,%rdi
mov    %r13,%rsi
mov    %r15,%rdx
mov    %ebx,%ecx
call   1040 <fprintf@plt>
add    $0x1,%ebx
cmp    %ebx,%r14d
jne    1150 <gen_bounds_setup+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c" = _REG_MYLO(%s, %d);\0A\00"
@.str.1 = [23 x i8] c" = _REG_MYHI(%s, %d);\0A\00"
define void @gen_bounds_setup(i32* %0, i8* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %8
8: ; preds = %29, %3
%9 = load i32, i32* %7
%10 = load i32, i32* %6
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %32
12: ; preds = %8
%13 = load i32*, i32** %4
%14 = load i8*, i8** %5
%15 = load i32, i32* %7
%16 = call i32 @gen_bound(i32* %13, i8* %14, i32 %15, i32 0)
%17 = load i32*, i32** %4
%18 = load i8*, i8** %5
%19 = load i32, i32* %7
%20 = call i32 @fprintf(i32* %17, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %18, i32 %19)
%21 = load i32*, i32** %4
%22 = load i8*, i8** %5
%23 = load i32, i32* %7
%24 = call i32 @gen_bound(i32* %21, i8* %22, i32 %23, i32 1)
%25 = load i32*, i32** %4
%26 = load i8*, i8** %5
%27 = load i32, i32* %7
%28 = call i32 @fprintf(i32* %25, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %26, i32 %27)
br label %29
29: ; preds = %12
%30 = load i32, i32* %7
%31 = add nsw i32 %30, 1
store i32 %31, i32* %7
br label %8
32: ; preds = %8
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c" = _REG_MYLO(%s, %d);\0A\00"
@.str.1 = [23 x i8] c" = _REG_MYHI(%s, %d);\0A\00"
define void @gen_bounds_setup(i32* %0, i8* %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %13
5: ; preds = %3, %5
%6 = phi i32 [ %11, %5 ], [ 0, %3 ]
%7 = tail call i32 @gen_bound(i32* %0, i8* %1, i32 %6, i32 0)
%8 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %6)
%9 = tail call i32 @gen_bound(i32* %0, i8* %1, i32 %6, i32 1)
%10 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %1, i32 %6)
%11 = add nuw nsw i32 %6, 1
%12 = icmp eq i32 %11, %2
br i1 %12, label %13, label %5
13: ; preds = %5, %3
ret void
}