void putFinderPattern(unsigned char *frame, int width, int ox, int oy) {
  static const unsigned char finder[] = {
      0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc0, 0xc0,
      0xc0, 0xc0, 0xc0, 0xc1, 0xc1, 0xc0, 0xc1, 0xc1, 0xc1, 0xc0,
      0xc1, 0xc1, 0xc0, 0xc1, 0xc1, 0xc1, 0xc0, 0xc1, 0xc1, 0xc0,
      0xc1, 0xc1, 0xc1, 0xc0, 0xc1, 0xc1, 0xc0, 0xc0, 0xc0, 0xc0,
      0xc0, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1,
  };
  int x, y;
  const unsigned char *s;
  frame += oy * width + ox;
  s = finder;
  for (y = 0; y < 7; y++) {
    for (x = 0; x < 7; x++) {
      frame[x] = s[x];
    }
    frame += width;
    s += 7;
  }
}


x86 assembly (clang, -O0):
<putFinderPattern>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
imul   -0xc(%rbp),%ecx
add    -0x10(%rbp),%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
lea    0xed0(%rip),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x7,-0x1c(%rbp)
jge    11a5 <putFinderPattern+0xa5>
movl   $0x0,-0x18(%rbp)
cmpl   $0x7,-0x18(%rbp)
jge    117a <putFinderPattern+0x7a>
mov    -0x28(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114c <putFinderPattern+0x4c>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x28(%rbp),%rax
add    $0x7,%rax
mov    %rax,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113b <putFinderPattern+0x3b>
pop    %rbp
ret

x86 assembly (clang, -O2):
<putFinderPattern>:
imul   %esi,%ecx
add    %edx,%ecx
movslq %ecx,%rax
lea    (%rdi,%rax,1),%rcx
movslq %esi,%rdx
lea    (%rcx,%rdx,1),%rsi
movl   $0xc1c1c1c1,0x3(%rdi,%rax,1)
c1
movl   $0xc1c1c1c1,(%rdi,%rax,1)
movb   $0xc1,(%rdx,%rcx,1)
movl   $0xc0c0c0c0,0x1(%rdx,%rcx,1)
c0
movw   $0xc1c0,0x5(%rdx,%rcx,1)
lea    (%rsi,%rdx,1),%rax
movl   $0xc1c1c0c1,(%rdx,%rsi,1)
movw   $0xc0c1,0x4(%rdx,%rsi,1)
movb   $0xc1,0x6(%rdx,%rsi,1)
lea    (%rax,%rdx,1),%rcx
movl   $0xc1c1c0c1,(%rdx,%rax,1)
movw   $0xc0c1,0x4(%rdx,%rax,1)
movb   $0xc1,0x6(%rdx,%rax,1)
lea    (%rcx,%rdx,1),%rax
movl   $0xc1c1c0c1,(%rdx,%rcx,1)
movw   $0xc0c1,0x4(%rdx,%rcx,1)
movb   $0xc1,0x6(%rdx,%rcx,1)
lea    (%rax,%rdx,1),%rcx
movb   $0xc1,(%rdx,%rax,1)
movw   $0xc1c0,0x5(%rdx,%rax,1)
movl   $0xc0c0c0c0,0x1(%rdx,%rax,1)
c0
movl   $0xc1c1c1c1,0x3(%rdx,%rcx,1)
c1
movl   $0xc1c1c1c1,(%rdx,%rcx,1)
ret

LLVM IR (-O0):
@putFinderPattern.finder = internal constant [49 x i8] c"\C1\C1\C1\C1\C1\C1\C1\C1\C0\C0\C0\C0\C0\C1\C1\C0\C1\C1\C1\C0\C1\C1\C0\C1\C1\C1\C0\C1\C1\C0\C1\C1\C1\C0\C1\C1\C0\C0\C0\C0\C0\C1\C1\C1\C1\C1\C1\C1\C1"
define void @putFinderPattern(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%12 = load i32, i32* %8
%13 = load i32, i32* %6
%14 = mul nsw i32 %12, %13
%15 = load i32, i32* %7
%16 = add nsw i32 %14, %15
%17 = load i8*, i8** %5
%18 = sext i32 %16 to i64
%19 = getelementptr inbounds i8, i8* %17, i64 %18
store i8* %19, i8** %5
store i8* getelementptr inbounds ([49 x i8], [49 x i8]* @putFinderPattern.finder, i64 0, i64 0), i8** %11
store i32 0, i32* %10
br label %20
20: ; preds = %47, %4
%21 = load i32, i32* %10
%22 = icmp slt i32 %21, 7
br i1 %22, label %23, label %50
23: ; preds = %20
store i32 0, i32* %9
br label %24
24: ; preds = %37, %23
%25 = load i32, i32* %9
%26 = icmp slt i32 %25, 7
br i1 %26, label %27, label %40
27: ; preds = %24
%28 = load i8*, i8** %11
%29 = load i32, i32* %9
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
%32 = load i8, i8* %31
%33 = load i8*, i8** %5
%34 = load i32, i32* %9
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %33, i64 %35
store i8 %32, i8* %36
br label %37
37: ; preds = %27
%38 = load i32, i32* %9
%39 = add nsw i32 %38, 1
store i32 %39, i32* %9
br label %24
40: ; preds = %24
%41 = load i32, i32* %6
%42 = load i8*, i8** %5
%43 = sext i32 %41 to i64
%44 = getelementptr inbounds i8, i8* %42, i64 %43
store i8* %44, i8** %5
%45 = load i8*, i8** %11
%46 = getelementptr inbounds i8, i8* %45, i64 7
store i8* %46, i8** %11
br label %47
47: ; preds = %40
%48 = load i32, i32* %10
%49 = add nsw i32 %48, 1
store i32 %49, i32* %10
br label %20
50: ; preds = %20
ret void
}

LLVM IR (-O2):
define void @putFinderPattern(i8* nocapture writeonly %0, i32 %1, i32 %2, i32 %3) {
%5 = mul nsw i32 %3, %1
%6 = add nsw i32 %5, %2
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = sext i32 %1 to i64
%10 = getelementptr inbounds i8, i8* %8, i64 %9
store i8 -63, i8* %10
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = getelementptr inbounds i8, i8* %10, i64 6
store i8 -63, i8* %12
%13 = getelementptr inbounds i8, i8* %10, i64 %9
store i8 -63, i8* %13
%14 = getelementptr inbounds i8, i8* %13, i64 1
store i8 -64, i8* %14
%15 = getelementptr inbounds i8, i8* %13, i64 2
store i8 -63, i8* %15
%16 = getelementptr inbounds i8, i8* %13, i64 3
store i8 -63, i8* %16
%17 = getelementptr inbounds i8, i8* %13, i64 4
store i8 -63, i8* %17
%18 = getelementptr inbounds i8, i8* %13, i64 5
store i8 -64, i8* %18
%19 = getelementptr inbounds i8, i8* %13, i64 6
store i8 -63, i8* %19
%20 = getelementptr inbounds i8, i8* %13, i64 %9
store i8 -63, i8* %20
%21 = getelementptr inbounds i8, i8* %20, i64 1
store i8 -64, i8* %21
%22 = getelementptr inbounds i8, i8* %20, i64 2
store i8 -63, i8* %22
%23 = getelementptr inbounds i8, i8* %20, i64 3
store i8 -63, i8* %23
%24 = getelementptr inbounds i8, i8* %20, i64 4
store i8 -63, i8* %24
%25 = getelementptr inbounds i8, i8* %20, i64 5
store i8 -64, i8* %25
%26 = getelementptr inbounds i8, i8* %20, i64 6
store i8 -63, i8* %26
%27 = getelementptr inbounds i8, i8* %20, i64 %9
store i8 -63, i8* %27
%28 = getelementptr inbounds i8, i8* %27, i64 1
store i8 -64, i8* %28
%29 = getelementptr inbounds i8, i8* %27, i64 2
store i8 -63, i8* %29
%30 = getelementptr inbounds i8, i8* %27, i64 3
store i8 -63, i8* %30
%31 = getelementptr inbounds i8, i8* %27, i64 4
store i8 -63, i8* %31
%32 = getelementptr inbounds i8, i8* %27, i64 5
store i8 -64, i8* %32
%33 = getelementptr inbounds i8, i8* %27, i64 6
store i8 -63, i8* %33
%34 = getelementptr inbounds i8, i8* %27, i64 %9
store i8 -63, i8* %34
%35 = getelementptr inbounds i8, i8* %34, i64 1
%36 = getelementptr inbounds i8, i8* %34, i64 6
store i8 -63, i8* %36
%37 = getelementptr inbounds i8, i8* %34, i64 %9
ret void
}