void BoundIDctMatrix(int *matrix) {
  static char RoutineName[] = "BoundIDctMatrix";
  int *mptr;
  for (mptr = matrix; mptr < matrix + 64; mptr++) {
    if (*mptr < 0) {
      *mptr = 0;
    } else if (*mptr > 255) {
      *mptr = 255;
    }
  }
}


x86 assembly (clang, -O0):
<BoundIDctMatrix>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
add    $0x100,%rcx
cmp    %rcx,%rax
jae    1179 <BoundIDctMatrix+0x79>
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
jge    1144 <BoundIDctMatrix+0x44>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
jmp    1163 <BoundIDctMatrix+0x63>
mov    -0x10(%rbp),%rax
cmpl   $0xff,(%rax)
jle    115e <BoundIDctMatrix+0x5e>
mov    -0x10(%rbp),%rax
movl   $0xff,(%rax)
jmp    1163 <BoundIDctMatrix+0x63>
jmp    1168 <BoundIDctMatrix+0x68>
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <BoundIDctMatrix+0x10>
pop    %rbp
ret

x86 assembly (clang, -O2):
<BoundIDctMatrix>:
xor    %eax,%eax
jmp    1120 <BoundIDctMatrix+0x20>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %ecx,%ecx
mov    %ecx,0x4(%rdi,%rax,4)
add    $0x2,%rax
cmp    $0x40,%rax
je     1153 <BoundIDctMatrix+0x53>
mov    (%rdi,%rax,4),%edx
mov    $0x0,%ecx
test   %edx,%edx
js     1139 <BoundIDctMatrix+0x39>
mov    $0xff,%ecx
cmp    $0x100,%edx
jb     113c <BoundIDctMatrix+0x3c>
mov    %ecx,(%rdi,%rax,4)
mov    0x4(%rdi,%rax,4),%edx
test   %edx,%edx
js     1110 <BoundIDctMatrix+0x10>
mov    $0xff,%ecx
cmp    $0x100,%edx
jae    1112 <BoundIDctMatrix+0x12>
jmp    1116 <BoundIDctMatrix+0x16>
ret

LLVM IR (-O0):
@BoundIDctMatrix.RoutineName = internal global [16 x i8] c"BoundIDctMatrix\00"
define void @BoundIDctMatrix(i32* %0) {
%2 = alloca i32*
%3 = alloca i32*
store i32* %0, i32** %2
%4 = load i32*, i32** %2
store i32* %4, i32** %3
br label %5
5: ; preds = %24, %1
%6 = load i32*, i32** %3
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 64
%9 = icmp ult i32* %6, %8
br i1 %9, label %10, label %27
10: ; preds = %5
%11 = load i32*, i32** %3
%12 = load i32, i32* %11
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = load i32*, i32** %3
store i32 0, i32* %15
br label %23
16: ; preds = %10
%17 = load i32*, i32** %3
%18 = load i32, i32* %17
%19 = icmp sgt i32 %18, 255
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = load i32*, i32** %3
store i32 255, i32* %21
br label %22
22: ; preds = %20, %16
br label %23
23: ; preds = %22, %14
br label %24
24: ; preds = %23
%25 = load i32*, i32** %3
%26 = getelementptr inbounds i32, i32* %25, i32 1
store i32* %26, i32** %3
br label %5
27: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @BoundIDctMatrix(i32* nocapture %0) {
br label %2
2: ; preds = %20, %1
%3 = phi i32* [ %0, %1 ], [ %22, %20 ]
%4 = phi i64 [ 0, %1 ], [ %21, %20 ]
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = icmp ugt i32 %5, 255
br i1 %8, label %9, label %11
9: ; preds = %7, %2
%10 = phi i32 [ 0, %2 ], [ 255, %7 ]
store i32 %10, i32* %3
br label %11
11: ; preds = %9, %7
%12 = or i64 %4, 1
%13 = getelementptr inbounds i32, i32* %0, i64 %12
%14 = load i32, i32* %13
%15 = icmp slt i32 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %11
%17 = icmp ugt i32 %14, 255
br i1 %17, label %18, label %20
18: ; preds = %16, %11
%19 = phi i32 [ 0, %11 ], [ 255, %16 ]
store i32 %19, i32* %13
br label %20
20: ; preds = %18, %16
%21 = add nuw nsw i64 %4, 2
%22 = getelementptr inbounds i32, i32* %0, i64 %21
%23 = icmp eq i64 %21, 64
br i1 %23, label %24, label %2
24: ; preds = %20
ret void
}