#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 uint8_t;
typedef int /*<<< orphan*/ qrcode;

/* Variables and functions */
int /*<<< orphan*/ fillRectangle(int, int, int, int, int *);
int getAlignmentPatternPositions(int, int *);
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int);
void initializeFunctionModules(int version, uint8_t qrcode[]) {
  int qrsize = version * 4 + 17;
  memset(qrcode, 0, ((qrsize * qrsize + 7) / 8 + 1) * sizeof(qrcode[0]));
  qrcode[0] = (uint8_t)qrsize;
  fillRectangle(6, 0, 1, qrsize, qrcode);
  fillRectangle(0, 6, qrsize, 1, qrcode);
  fillRectangle(0, 0, 9, 9, qrcode);
  fillRectangle(qrsize - 8, 0, 8, 9, qrcode);
  fillRectangle(0, qrsize - 8, 9, 8, qrcode);
  uint8_t alignPatPos[7] = {0};
  int numAlign = getAlignmentPatternPositions(version, alignPatPos);
  for (int i = 0; i < numAlign; i++) {
    for (int j = 0; j < numAlign; j++) {
      if ((i == 0 && j == 0) || (i == 0 && j == numAlign - 1) ||
          (i == numAlign - 1 && j == 0))
        continue;
      else
        fillRectangle(alignPatPos[i] - 2, alignPatPos[j] - 2, 5, 5, qrcode);
    }
  }
  if (version >= 7) {
    fillRectangle(qrsize - 11, 0, 3, 6, qrcode);
    fillRectangle(0, qrsize - 11, 6, 3, qrcode);
  }
}


x86 assembly (clang, -O0):
<initializeFunctionModules>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x2,%eax
add    $0x11,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%eax
imul   -0x14(%rbp),%eax
add    $0x7,%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
add    $0x1,%eax
cltq
shl    $0x2,%rax
mov    %eax,%edx
xor    %esi,%esi
call   1040 <memset@plt>
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%r8
mov    $0x6,%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1030 <fillRectangle@plt>
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%r8
xor    %edi,%edi
mov    $0x6,%esi
mov    $0x1,%ecx
call   1030 <fillRectangle@plt>
mov    -0x10(%rbp),%r8
xor    %esi,%esi
mov    $0x9,%ecx
mov    %esi,%edi
mov    %ecx,%edx
call   1030 <fillRectangle@plt>
mov    -0x14(%rbp),%edi
sub    $0x8,%edi
mov    -0x10(%rbp),%r8
xor    %esi,%esi
mov    $0x8,%edx
mov    $0x9,%ecx
call   1030 <fillRectangle@plt>
mov    -0x14(%rbp),%esi
sub    $0x8,%esi
mov    -0x10(%rbp),%r8
xor    %edi,%edi
mov    $0x9,%edx
mov    $0x8,%ecx
call   1030 <fillRectangle@plt>
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x1c,%edx
call   1040 <memset@plt>
mov    -0x4(%rbp),%edi
lea    -0x30(%rbp),%rsi
call   1050 <getAlignmentPatternPositions@plt>
mov    %eax,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    12d6 <initializeFunctionModules+0x1a6>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    12c3 <initializeFunctionModules+0x193>
cmpl   $0x0,-0x38(%rbp)
jne    124f <initializeFunctionModules+0x11f>
cmpl   $0x0,-0x3c(%rbp)
je     1285 <initializeFunctionModules+0x155>
cmpl   $0x0,-0x38(%rbp)
jne    126a <initializeFunctionModules+0x13a>
mov    -0x3c(%rbp),%eax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     1285 <initializeFunctionModules+0x155>
mov    -0x38(%rbp),%eax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    128a <initializeFunctionModules+0x15a>
cmpl   $0x0,-0x3c(%rbp)
jne    128a <initializeFunctionModules+0x15a>
jmp    12b5 <initializeFunctionModules+0x185>
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edi
sub    $0x2,%edi
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
sub    $0x2,%esi
mov    -0x10(%rbp),%r8
mov    $0x5,%ecx
mov    %ecx,%edx
call   1030 <fillRectangle@plt>
jmp    12b5 <initializeFunctionModules+0x185>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    122f <initializeFunctionModules+0xff>
jmp    12c8 <initializeFunctionModules+0x198>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    121c <initializeFunctionModules+0xec>
cmpl   $0x7,-0x4(%rbp)
jl     1316 <initializeFunctionModules+0x1e6>
mov    -0x14(%rbp),%edi
sub    $0xb,%edi
mov    -0x10(%rbp),%r8
xor    %esi,%esi
mov    $0x3,%edx
mov    $0x6,%ecx
call   1030 <fillRectangle@plt>
mov    -0x14(%rbp),%esi
sub    $0xb,%esi
mov    -0x10(%rbp),%r8
xor    %edi,%edi
mov    $0x6,%edx
mov    $0x3,%ecx
call   1030 <fillRectangle@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initializeFunctionModules>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r15
mov    %edi,%r14d
lea    0x11(,%r14,4),%ebp
mov    %ebp,%edx
imul   %ebp,%edx
add    $0x7,%edx
shr    %edx
and    $0x3ffffffc,%edx
add    $0x4,%edx
mov    %rsi,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
mov    %ebp,(%r15)
mov    $0x6,%edi
xor    %esi,%esi
mov    $0x1,%edx
mov    %ebp,%ecx
mov    %r15,%r8
call   1030 <fillRectangle@plt>
xor    %edi,%edi
mov    $0x6,%esi
mov    %ebp,%edx
mov    $0x1,%ecx
mov    %r15,%r8
call   1030 <fillRectangle@plt>
xor    %edi,%edi
xor    %esi,%esi
mov    $0x9,%edx
mov    $0x9,%ecx
mov    %r15,%r8
call   1030 <fillRectangle@plt>
lea    0x9(,%r14,4),%ebp
mov    %ebp,%edi
xor    %esi,%esi
mov    $0x8,%edx
mov    $0x9,%ecx
mov    %r15,%r8
call   1030 <fillRectangle@plt>
xor    %edi,%edi
mov    %ebp,%esi
mov    $0x9,%edx
mov    $0x8,%ecx
mov    %r15,%r8
call   1030 <fillRectangle@plt>
xorps  %xmm0,%xmm0
movups %xmm0,0xc(%rsp)
movaps %xmm0,(%rsp)
mov    %rsp,%rsi
mov    %r14d,%edi
call   1050 <getAlignmentPatternPositions@plt>
test   %eax,%eax
jle    1267 <initializeFunctionModules+0x137>
lea    -0x1(%rax),%r12d
mov    %eax,%r13d
xor    %ebp,%ebp
jmp    1219 <initializeFunctionModules+0xe9>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbp
cmp    %r13,%rbp
je     1267 <initializeFunctionModules+0x137>
xor    %ebx,%ebx
jmp    1249 <initializeFunctionModules+0x119>
mov    (%rsp,%rbp,4),%edi
add    $0xfffffffe,%edi
mov    (%rsp,%rbx,4),%esi
add    $0xfffffffe,%esi
mov    $0x5,%edx
mov    $0x5,%ecx
mov    %r15,%r8
call   1030 <fillRectangle@plt>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %rbx,%r13
je     1210 <initializeFunctionModules+0xe0>
mov    %rbp,%rax
or     %rbx,%rax
je     1240 <initializeFunctionModules+0x110>
test   %rbp,%rbp
jne    125b <initializeFunctionModules+0x12b>
cmp    %rbx,%r12
je     1240 <initializeFunctionModules+0x110>
cmp    %r12,%rbp
jne    121d <initializeFunctionModules+0xed>
test   %rbx,%rbx
je     1240 <initializeFunctionModules+0x110>
jmp    121d <initializeFunctionModules+0xed>
cmp    $0x6,%r14d
jle    12a3 <initializeFunctionModules+0x173>
shl    $0x2,%r14d
add    $0x6,%r14d
mov    %r14d,%edi
xor    %esi,%esi
mov    $0x3,%edx
mov    $0x6,%ecx
mov    %r15,%r8
call   1030 <fillRectangle@plt>
xor    %edi,%edi
mov    %r14d,%esi
mov    $0x6,%edx
mov    $0x3,%ecx
mov    %r15,%r8
call   1030 <fillRectangle@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @initializeFunctionModules(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca [7 x i32]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %3
store i32* %1, i32** %4
%10 = load i32, i32* %3
%11 = mul nsw i32 %10, 4
%12 = add nsw i32 %11, 17
store i32 %12, i32* %5
%13 = load i32*, i32** %4
%14 = load i32, i32* %5
%15 = load i32, i32* %5
%16 = mul nsw i32 %14, %15
%17 = add nsw i32 %16, 7
%18 = sdiv i32 %17, 8
%19 = add nsw i32 %18, 1
%20 = sext i32 %19 to i64
%21 = mul i64 %20, 4
%22 = trunc i64 %21 to i32
%23 = call i32 @memset(i32* %13, i32 0, i32 %22)
%24 = load i32, i32* %5
%25 = load i32*, i32** %4
%26 = getelementptr inbounds i32, i32* %25, i64 0
store i32 %24, i32* %26
%27 = load i32, i32* %5
%28 = load i32*, i32** %4
%29 = call i32 @fillRectangle(i32 6, i32 0, i32 1, i32 %27, i32* %28)
%30 = load i32, i32* %5
%31 = load i32*, i32** %4
%32 = call i32 @fillRectangle(i32 0, i32 6, i32 %30, i32 1, i32* %31)
%33 = load i32*, i32** %4
%34 = call i32 @fillRectangle(i32 0, i32 0, i32 9, i32 9, i32* %33)
%35 = load i32, i32* %5
%36 = sub nsw i32 %35, 8
%37 = load i32*, i32** %4
%38 = call i32 @fillRectangle(i32 %36, i32 0, i32 8, i32 9, i32* %37)
%39 = load i32, i32* %5
%40 = sub nsw i32 %39, 8
%41 = load i32*, i32** %4
%42 = call i32 @fillRectangle(i32 0, i32 %40, i32 9, i32 8, i32* %41)
%43 = bitcast [7 x i32]* %6 to i8*
%44 = load i32, i32* %3
%45 = getelementptr inbounds [7 x i32], [7 x i32]* %6, i64 0, i64 0
%46 = call i32 @getAlignmentPatternPositions(i32 %44, i32* %45)
store i32 %46, i32* %7
store i32 0, i32* %8
br label %47
47: ; preds = %97, %2
%48 = load i32, i32* %8
%49 = load i32, i32* %7
%50 = icmp slt i32 %48, %49
br i1 %50, label %51, label %100
51: ; preds = %47
store i32 0, i32* %9
br label %52
52: ; preds = %93, %51
%53 = load i32, i32* %9
%54 = load i32, i32* %7
%55 = icmp slt i32 %53, %54
br i1 %55, label %56, label %96
56: ; preds = %52
%57 = load i32, i32* %8
%58 = icmp eq i32 %57, 0
br i1 %58, label %59, label %62
59: ; preds = %56
%60 = load i32, i32* %9
%61 = icmp eq i32 %60, 0
br i1 %61, label %78, label %62
62: ; preds = %59, %56
%63 = load i32, i32* %8
%64 = icmp eq i32 %63, 0
br i1 %64, label %65, label %70
65: ; preds = %62
%66 = load i32, i32* %9
%67 = load i32, i32* %7
%68 = sub nsw i32 %67, 1
%69 = icmp eq i32 %66, %68
br i1 %69, label %78, label %70
70: ; preds = %65, %62
%71 = load i32, i32* %8
%72 = load i32, i32* %7
%73 = sub nsw i32 %72, 1
%74 = icmp eq i32 %71, %73
br i1 %74, label %75, label %79
75: ; preds = %70
%76 = load i32, i32* %9
%77 = icmp eq i32 %76, 0
br i1 %77, label %78, label %79
78: ; preds = %75, %65, %59
br label %93
79: ; preds = %75, %70
%80 = load i32, i32* %8
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds [7 x i32], [7 x i32]* %6, i64 0, i64 %81
%83 = load i32, i32* %82
%84 = sub nsw i32 %83, 2
%85 = load i32, i32* %9
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds [7 x i32], [7 x i32]* %6, i64 0, i64 %86
%88 = load i32, i32* %87
%89 = sub nsw i32 %88, 2
%90 = load i32*, i32** %4
%91 = call i32 @fillRectangle(i32 %84, i32 %89, i32 5, i32 5, i32* %90)
br label %92
92: ; preds = %79
br label %93
93: ; preds = %92, %78
%94 = load i32, i32* %9
%95 = add nsw i32 %94, 1
store i32 %95, i32* %9
br label %52
96: ; preds = %52
br label %97
97: ; preds = %96
%98 = load i32, i32* %8
%99 = add nsw i32 %98, 1
store i32 %99, i32* %8
br label %47
100: ; preds = %47
%101 = load i32, i32* %3
%102 = icmp sge i32 %101, 7
br i1 %102, label %103, label %112
103: ; preds = %100
%104 = load i32, i32* %5
%105 = sub nsw i32 %104, 11
%106 = load i32*, i32** %4
%107 = call i32 @fillRectangle(i32 %105, i32 0, i32 3, i32 6, i32* %106)
%108 = load i32, i32* %5
%109 = sub nsw i32 %108, 11
%110 = load i32*, i32** %4
%111 = call i32 @fillRectangle(i32 0, i32 %109, i32 6, i32 3, i32* %110)
br label %112
112: ; preds = %103, %100
ret void
}

LLVM IR (-O2):
define void @initializeFunctionModules(i32 %0, i32* %1) {
%3 = alloca [7 x i32]
%4 = shl nsw i32 %0, 2
%5 = add nsw i32 %4, 17
%6 = mul nsw i32 %5, %5
%7 = add nuw nsw i32 %6, 7
%8 = lshr exact i32 %7, 1
%9 = and i32 %8, 1073741820
%10 = add nuw nsw i32 %9, 4
%11 = tail call i32 @memset(i32* %1, i32 0, i32 %10)
store i32 %5, i32* %1
%12 = tail call i32 @fillRectangle(i32 6, i32 0, i32 1, i32 %5, i32* %1)
%13 = tail call i32 @fillRectangle(i32 0, i32 6, i32 %5, i32 1, i32* %1)
%14 = tail call i32 @fillRectangle(i32 0, i32 0, i32 9, i32 9, i32* %1)
%15 = add nsw i32 %4, 9
%16 = tail call i32 @fillRectangle(i32 %15, i32 0, i32 8, i32 9, i32* %1)
%17 = tail call i32 @fillRectangle(i32 0, i32 %15, i32 9, i32 8, i32* %1)
%18 = bitcast [7 x i32]* %3 to i8*
%19 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 0
%20 = call i32 @getAlignmentPatternPositions(i32 %0, i32* %19)
%21 = icmp sgt i32 %20, 0
br i1 %21, label %22, label %31
22: ; preds = %2
%23 = add nsw i32 %20, -1
%24 = zext i32 %23 to i64
%25 = zext i32 %20 to i64
br label %26
26: ; preds = %33, %22
%27 = phi i64 [ 0, %22 ], [ %34, %33 ]
%28 = icmp eq i64 %27, 0
%29 = icmp eq i64 %27, %24
%30 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 %27
br label %36
31: ; preds = %33, %2
%32 = icmp sgt i32 %0, 6
br i1 %32, label %55, label %59
33: ; preds = %52
%34 = add nuw nsw i64 %27, 1
%35 = icmp eq i64 %34, %25
br i1 %35, label %31, label %26
36: ; preds = %26, %52
%37 = phi i64 [ 0, %26 ], [ %53, %52 ]
%38 = icmp eq i64 %37, 0
%39 = select i1 %28, i1 %38, i1 false
br i1 %39, label %52, label %40
40: ; preds = %36
%41 = icmp eq i64 %37, %24
%42 = select i1 %28, i1 %41, i1 false
br i1 %42, label %52, label %43
43: ; preds = %40
%44 = select i1 %29, i1 %38, i1 false
br i1 %44, label %52, label %45
45: ; preds = %43
%46 = load i32, i32* %30
%47 = add nsw i32 %46, -2
%48 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 %37
%49 = load i32, i32* %48
%50 = add nsw i32 %49, -2
%51 = call i32 @fillRectangle(i32 %47, i32 %50, i32 5, i32 5, i32* %1)
br label %52
52: ; preds = %40, %36, %43, %45
%53 = add nuw nsw i64 %37, 1
%54 = icmp eq i64 %53, %25
br i1 %54, label %33, label %36
55: ; preds = %31
%56 = add nsw i32 %4, 6
%57 = call i32 @fillRectangle(i32 %56, i32 0, i32 3, i32 6, i32* %1)
%58 = call i32 @fillRectangle(i32 0, i32 %56, i32 6, i32 3, i32* %1)
br label %59
59: ; preds = %55, %31
ret void
}