#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 RTLD_LOCAL;
int RTLD_NOW;
int /*<<< orphan*/ dlclose(void *);
char *dlerror();
void *dlopen(char *, int);
scalar_t__ dlsym(void *, char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int main(int argc, char **argv) {
  if (argc == 1) {
    printf("Usage: %s 'text'\n", argv[0]);
    printf("Creates TEXT-type QR-code for 'text' in UTF-8/ANSI output.\n");
    exit(1);
  }
  const char *url = argv[1];
  void *qrencode = dlopen("libqrencode.so.3", RTLD_NOW | RTLD_LOCAL);
  if (!qrencode) {
    qrencode = dlopen("libqrencode.so.4", RTLD_NOW | RTLD_LOCAL);
  }
  if (!qrencode) {
    printf("dlopen: %s\n", dlerror());
    printf("Make sure libqrencode is installed.\n");
    exit(1);
  }
  typedef struct {
    int version;
    int width;
    unsigned char *data;
  } QRcode;
  QRcode *(*QRcode_encodeString8bit)(const char *, int, int) =
      (QRcode * (*)(const char *, int, int))
          dlsym(qrencode, "QRcode_encodeString8bit");
  void (*QRcode_free)(QRcode * qrcode) =
      (void (*)(QRcode *))dlsym(qrencode, "QRcode_free");
  if (QRcode_encodeString8bit && QRcode_free) {
    QRcode *qrcode = QRcode_encodeString8bit(url, 0, 1);
    printf("\x1B[30;47;27m");
    for (int i = 0; i < qrcode->width + 4; ++i) {
      printf(" ");
    }
    puts("\x1B[0m");
    for (int y = 0; y < qrcode->width; y += 2) {
      printf("\x1B[30;47;27m"
             "  ");
      for (int x = 0; x < qrcode->width; ++x) {
        int top = qrcode->data[y * qrcode->width + x] & 1;
        int bottom = 0;
        if (y + 1 < qrcode->width) {
          bottom = qrcode->data[(y + 1) * qrcode->width + x] & 1;
        }
        if (top) {
          if (bottom) {
            printf("\xE2\x96\x88");
          } else {
            printf("\xE2\x96\x80");
          }
        } else {
          if (bottom) {
            printf("\xE2\x96\x84");
          } else {
            printf(" ");
          }
        }
      }
      puts("  "
           "\x1B[0m");
    }
    printf("\x1B[30;47;27m");
    for (int i = 0; i < qrcode->width + 4; ++i) {
      printf(" ");
    }
    puts("\x1B[0m");
    QRcode_free(qrcode);
  } else {
    printf("dlsym: %s\n", dlerror());
    printf("Make sure libqrencode is installed properly.\n");
    exit(1);
  }
  dlclose(qrencode);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    11bd <main+0x4d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    0x2e18(%rip),%rax
mov    (%rax),%esi
mov    0x2df7(%rip),%rax
or     (%rax),%esi
lea    0xe6c(%rip),%rdi
call   1060 <dlopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1218 <main+0xa8>
mov    0x2deb(%rip),%rax
mov    (%rax),%esi
mov    0x2dca(%rip),%rax
or     (%rax),%esi
lea    0xe50(%rip),%rdi
call   1060 <dlopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1253 <main+0xe3>
mov    $0x0,%al
call   1030 <dlerror@plt>
mov    %rax,%rsi
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x20(%rbp),%rdi
lea    0xe43(%rip),%rsi
call   1070 <dlsym@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe47(%rip),%rsi
call   1070 <dlsym@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     148f <main+0x31f>
cmpq   $0x0,-0x30(%rbp)
je     148f <main+0x31f>
mov    -0x28(%rbp),%rax
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   *%rax
mov    %rax,-0x38(%rbp)
lea    0xe18(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    -0x38(%rbp),%rcx
mov    0x4(%rcx),%ecx
add    $0x4,%ecx
cmp    %ecx,%eax
jge    12ec <main+0x17c>
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    12bb <main+0x14b>
lea    0xdfa(%rip),%rdi
call   1040 <puts@plt>
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
mov    -0x38(%rbp),%rcx
cmp    0x4(%rcx),%eax
jge    142e <main+0x2be>
lea    0xdbb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    -0x38(%rbp),%rcx
cmp    0x4(%rcx),%eax
jge    1414 <main+0x2a4>
mov    -0x38(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0x40(%rbp),%ecx
mov    -0x38(%rbp),%rdx
imul   0x4(%rdx),%ecx
add    -0x44(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
and    $0x1,%eax
mov    %eax,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    -0x38(%rbp),%rcx
cmp    0x4(%rcx),%eax
jge    1397 <main+0x227>
mov    -0x38(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0x40(%rbp),%ecx
add    $0x1,%ecx
mov    -0x38(%rbp),%rdx
imul   0x4(%rdx),%ecx
add    -0x44(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
and    $0x1,%eax
mov    %eax,-0x4c(%rbp)
cmpl   $0x0,-0x48(%rbp)
je     13d1 <main+0x261>
cmpl   $0x0,-0x4c(%rbp)
je     13be <main+0x24e>
lea    0xd2d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    13cc <main+0x25c>
lea    0xd1e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1401 <main+0x291>
cmpl   $0x0,-0x4c(%rbp)
je     13ee <main+0x27e>
lea    0xd05(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    13fc <main+0x28c>
lea    0xce8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1401 <main+0x291>
jmp    1406 <main+0x296>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1324 <main+0x1b4>
lea    0xcd0(%rip),%rdi
call   1040 <puts@plt>
mov    -0x40(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x40(%rbp)
jmp    12ff <main+0x18f>
lea    0xc90(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%eax
mov    -0x38(%rbp),%rcx
mov    0x4(%rcx),%ecx
add    $0x4,%ecx
cmp    %ecx,%eax
jge    1474 <main+0x304>
lea    0xc7e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    1443 <main+0x2d3>
lea    0xc72(%rip),%rdi
call   1040 <puts@plt>
mov    -0x30(%rbp),%rax
mov    -0x38(%rbp),%rdi
call   *%rax
jmp    14bf <main+0x34f>
mov    $0x0,%al
call   1030 <dlerror@plt>
mov    %rax,%rsi
lea    0xc52(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xc4f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x20(%rbp),%rdi
call   1090 <dlclose@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x1,%edi
je     13b5 <main+0x235>
mov    0x8(%rsi),%r14
mov    0x2e46(%rip),%r15
mov    0x2e27(%rip),%rbp
mov    0x0(%rbp),%esi
or     (%r15),%esi
lea    0xe5c(%rip),%rdi
call   1070 <dlopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    11e1 <main+0x61>
mov    0x0(%rbp),%esi
or     (%r15),%esi
lea    0xe53(%rip),%rdi
call   1070 <dlopen@plt>
mov    %rax,%rbx
test   %rax,%rax
je     13f0 <main+0x270>
lea    0xe58(%rip),%rsi
mov    %rbx,%rdi
call   1080 <dlsym@plt>
mov    %rax,%rbp
lea    0xe5e(%rip),%rsi
mov    %rbx,%rdi
call   1080 <dlsym@plt>
test   %rbp,%rbp
je     13cf <main+0x24f>
test   %rax,%rax
je     13cf <main+0x24f>
mov    %rax,0x8(%rsp)
mov    %rbx,0x10(%rsp)
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   *%rbp
mov    %rax,%rbx
lea    0xe30(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
cmpl   $0xfffffffd,0x4(%rbx)
jl     1267 <main+0xe7>
mov    $0xffffffff,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1040 <putchar@plt>
mov    0x4(%rbx),%eax
add    $0x3,%eax
add    $0x1,%ebp
cmp    %eax,%ebp
jl     1250 <main+0xd0>
lea    0xe1e(%rip),%rdi
call   1050 <puts@plt>
cmpl   $0x0,0x4(%rbx)
jle    1349 <main+0x1c9>
mov    $0x1,%r12d
lea    0xdf8(%rip),%r14
xor    %r13d,%r13d
jmp    12ae <main+0x12e>
nop
lea    0xdf3(%rip),%rdi
call   1050 <puts@plt>
add    $0x2,%r13d
add    $0x2,%r12d
cmp    0x4(%rbx),%r13d
jge    1349 <main+0x1c9>
lea    0xdbb(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x4(%rbx),%eax
test   %eax,%eax
jle    1290 <main+0x110>
mov    %r13d,%r15d
or     $0x1,%r15d
xor    %ebp,%ebp
jmp    12e5 <main+0x165>
xchg   %ax,%ax
mov    $0x20,%edi
call   1040 <putchar@plt>
mov    0x4(%rbx),%eax
add    $0x1,%rbp
cmp    %eax,%ebp
jge    1290 <main+0x110>
mov    0x8(%rbx),%rcx
mov    %r13d,%edx
imul   %eax,%edx
movslq %edx,%rdx
add    %rcx,%rdx
movzbl 0x0(%rbp,%rdx,1),%edx
cmp    %eax,%r15d
jge    1320 <main+0x1a0>
imul   %r12d,%eax
add    %ebp,%eax
cltq
movzbl (%rcx,%rax,1),%eax
test   $0x1,%dl
jne    1330 <main+0x1b0>
test   $0x1,%al
je     12d0 <main+0x150>
lea    0xd6b(%rip),%rdi
jmp    1340 <main+0x1c0>
nopl   (%rax)
test   $0x1,%dl
je     12d0 <main+0x150>
jmp    1334 <main+0x1b4>
nopw   0x0(%rax,%rax,1)
test   $0x1,%al
jne    1339 <main+0x1b9>
mov    %r14,%rdi
jmp    1340 <main+0x1c0>
lea    0xd3e(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    12da <main+0x15a>
lea    0xd14(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
cmpl   $0xfffffffd,0x4(%rbx)
jl     1387 <main+0x207>
mov    $0xffffffff,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x20,%edi
call   1040 <putchar@plt>
mov    0x4(%rbx),%eax
add    $0x3,%eax
add    $0x1,%ebp
cmp    %eax,%ebp
jl     1370 <main+0x1f0>
lea    0xcfe(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
call   *0x8(%rsp)
mov    0x10(%rsp),%rdi
call   10a0 <dlclose@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%rsi),%rsi
lea    0xc41(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xd20(%rip),%rdi
jmp    140f <main+0x28f>
xor    %eax,%eax
call   1030 <dlerror@plt>
lea    0xcb4(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xcd2(%rip),%rdi
jmp    140f <main+0x28f>
xor    %eax,%eax
call   1030 <dlerror@plt>
lea    0xc36(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xc8d(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
%struct.QRcode = type { i32, i32, i8* }
@.str = [18 x i8] c"Usage: %s 'text'\0A\00"
@.str.1 = [60 x i8] c"Creates TEXT-type QR-code for 'text' in UTF-8/ANSI output.\0A\00"
@.str.2 = [17 x i8] c"libqrencode.so.3\00"
@RTLD_NOW = global i32 0
@RTLD_LOCAL = global i32 0
@.str.3 = [17 x i8] c"libqrencode.so.4\00"
@.str.4 = [12 x i8] c"dlopen: %s\0A\00"
@.str.5 = [37 x i8] c"Make sure libqrencode is installed.\0A\00"
@.str.6 = [24 x i8] c"QRcode_encodeString8bit\00"
@.str.7 = [12 x i8] c"QRcode_free\00"
@.str.8 = [12 x i8] c"\1B[30;47;27m\00"
@.str.9 = [2 x i8] c" \00"
@.str.10 = [5 x i8] c"\1B[0m\00"
@.str.11 = [14 x i8] c"\1B[30;47;27m \00"
@.str.12 = [4 x i8] c"\E2\96\88\00"
@.str.13 = [4 x i8] c"\E2\96\80\00"
@.str.14 = [4 x i8] c"\E2\96\84\00"
@.str.15 = [7 x i8] c" \1B[0m\00"
@.str.16 = [11 x i8] c"dlsym: %s\0A\00"
@.str.17 = [46 x i8] c"Make sure libqrencode is installed properly.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca %struct.QRcode* (i8*, i32, i32)*
%9 = alloca void (%struct.QRcode*)*
%10 = alloca %struct.QRcode*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = load i32, i32* %4
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %26
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 0
%22 = load i8*, i8** %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %22)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0))
%25 = call i32 @exit(i32 1)
unreachable
26: ; preds = %2
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
store i8* %29, i8** %6
%30 = load i32, i32* @RTLD_NOW
%31 = load i32, i32* @RTLD_LOCAL
%32 = or i32 %30, %31
%33 = call i8* @dlopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %32)
store i8* %33, i8** %7
%34 = load i8*, i8** %7
%35 = icmp ne i8* %34, null
br i1 %35, label %41, label %36
36: ; preds = %26
%37 = load i32, i32* @RTLD_NOW
%38 = load i32, i32* @RTLD_LOCAL
%39 = or i32 %37, %38
%40 = call i8* @dlopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %39)
store i8* %40, i8** %7
br label %41
41: ; preds = %36, %26
%42 = load i8*, i8** %7
%43 = icmp ne i8* %42, null
br i1 %43, label %49, label %44
44: ; preds = %41
%45 = call i8* (...) @dlerror()
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %45)
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0))
%48 = call i32 @exit(i32 1)
unreachable
49: ; preds = %41
%50 = load i8*, i8** %7
%51 = call i64 @dlsym(i8* %50, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%52 = inttoptr i64 %51 to %struct.QRcode* (i8*, i32, i32)*
store %struct.QRcode* (i8*, i32, i32)* %52, %struct.QRcode* (i8*, i32, i32)** %8
%53 = load i8*, i8** %7
%54 = call i64 @dlsym(i8* %53, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
%55 = inttoptr i64 %54 to void (%struct.QRcode*)*
store void (%struct.QRcode*)* %55, void (%struct.QRcode*)** %9
%56 = load %struct.QRcode* (i8*, i32, i32)*, %struct.QRcode* (i8*, i32, i32)** %8
%57 = icmp ne %struct.QRcode* (i8*, i32, i32)* %56, null
br i1 %57, label %58, label %179
58: ; preds = %49
%59 = load void (%struct.QRcode*)*, void (%struct.QRcode*)** %9
%60 = icmp ne void (%struct.QRcode*)* %59, null
br i1 %60, label %61, label %179
61: ; preds = %58
%62 = load %struct.QRcode* (i8*, i32, i32)*, %struct.QRcode* (i8*, i32, i32)** %8
%63 = load i8*, i8** %6
%64 = call %struct.QRcode* %62(i8* %63, i32 0, i32 1)
store %struct.QRcode* %64, %struct.QRcode** %10
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %11
br label %66
66: ; preds = %75, %61
%67 = load i32, i32* %11
%68 = load %struct.QRcode*, %struct.QRcode** %10
%69 = getelementptr inbounds %struct.QRcode, %struct.QRcode* %68, i32 0, i32 1
%70 = load i32, i32* %69
%71 = add nsw i32 %70, 4
%72 = icmp slt i32 %67, %71
br i1 %72, label %73, label %78
73: ; preds = %66
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %75
75: ; preds = %73
%76 = load i32, i32* %11
%77 = add nsw i32 %76, 1
store i32 %77, i32* %11
br label %66
78: ; preds = %66
%79 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
store i32 0, i32* %12
br label %80
80: ; preds = %158, %78
%81 = load i32, i32* %12
%82 = load %struct.QRcode*, %struct.QRcode** %10
%83 = getelementptr inbounds %struct.QRcode, %struct.QRcode* %82, i32 0, i32 1
%84 = load i32, i32* %83
%85 = icmp slt i32 %81, %84
br i1 %85, label %86, label %161
86: ; preds = %80
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0))
store i32 0, i32* %13
br label %88
88: ; preds = %153, %86
%89 = load i32, i32* %13
%90 = load %struct.QRcode*, %struct.QRcode** %10
%91 = getelementptr inbounds %struct.QRcode, %struct.QRcode* %90, i32 0, i32 1
%92 = load i32, i32* %91
%93 = icmp slt i32 %89, %92
br i1 %93, label %94, label %156
94: ; preds = %88
%95 = load %struct.QRcode*, %struct.QRcode** %10
%96 = getelementptr inbounds %struct.QRcode, %struct.QRcode* %95, i32 0, i32 2
%97 = load i8*, i8** %96
%98 = load i32, i32* %12
%99 = load %struct.QRcode*, %struct.QRcode** %10
%100 = getelementptr inbounds %struct.QRcode, %struct.QRcode* %99, i32 0, i32 1
%101 = load i32, i32* %100
%102 = mul nsw i32 %98, %101
%103 = load i32, i32* %13
%104 = add nsw i32 %102, %103
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds i8, i8* %97, i64 %105
%107 = load i8, i8* %106
%108 = zext i8 %107 to i32
%109 = and i32 %108, 1
store i32 %109, i32* %14
store i32 0, i32* %15
%110 = load i32, i32* %12
%111 = add nsw i32 %110, 1
%112 = load %struct.QRcode*, %struct.QRcode** %10
%113 = getelementptr inbounds %struct.QRcode, %struct.QRcode* %112, i32 0, i32 1
%114 = load i32, i32* %113
%115 = icmp slt i32 %111, %114
br i1 %115, label %116, label %133
116: ; preds = %94
%117 = load %struct.QRcode*, %struct.QRcode** %10
%118 = getelementptr inbounds %struct.QRcode, %struct.QRcode* %117, i32 0, i32 2
%119 = load i8*, i8** %118
%120 = load i32, i32* %12
%121 = add nsw i32 %120, 1
%122 = load %struct.QRcode*, %struct.QRcode** %10
%123 = getelementptr inbounds %struct.QRcode, %struct.QRcode* %122, i32 0, i32 1
%124 = load i32, i32* %123
%125 = mul nsw i32 %121, %124
%126 = load i32, i32* %13
%127 = add nsw i32 %125, %126
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds i8, i8* %119, i64 %128
%130 = load i8, i8* %129
%131 = zext i8 %130 to i32
%132 = and i32 %131, 1
store i32 %132, i32* %15
br label %133
133: ; preds = %116, %94
%134 = load i32, i32* %14
%135 = icmp ne i32 %134, 0
br i1 %135, label %136, label %144
136: ; preds = %133
%137 = load i32, i32* %15
%138 = icmp ne i32 %137, 0
br i1 %138, label %139, label %141
139: ; preds = %136
%140 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0))
br label %143
141: ; preds = %136
%142 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0))
br label %143
143: ; preds = %141, %139
br label %152
144: ; preds = %133
%145 = load i32, i32* %15
%146 = icmp ne i32 %145, 0
br i1 %146, label %147, label %149
147: ; preds = %144
%148 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0))
br label %151
149: ; preds = %144
%150 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %151
151: ; preds = %149, %147
br label %152
152: ; preds = %151, %143
br label %153
153: ; preds = %152
%154 = load i32, i32* %13
%155 = add nsw i32 %154, 1
store i32 %155, i32* %13
br label %88
156: ; preds = %88
%157 = call i32 @puts(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i64 0, i64 0))
br label %158
158: ; preds = %156
%159 = load i32, i32* %12
%160 = add nsw i32 %159, 2
store i32 %160, i32* %12
br label %80
161: ; preds = %80
%162 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %16
br label %163
163: ; preds = %172, %161
%164 = load i32, i32* %16
%165 = load %struct.QRcode*, %struct.QRcode** %10
%166 = getelementptr inbounds %struct.QRcode, %struct.QRcode* %165, i32 0, i32 1
%167 = load i32, i32* %166
%168 = add nsw i32 %167, 4
%169 = icmp slt i32 %164, %168
br i1 %169, label %170, label %175
170: ; preds = %163
%171 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %172
172: ; preds = %170
%173 = load i32, i32* %16
%174 = add nsw i32 %173, 1
store i32 %174, i32* %16
br label %163
175: ; preds = %163
%176 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
%177 = load void (%struct.QRcode*)*, void (%struct.QRcode*)** %9
%178 = load %struct.QRcode*, %struct.QRcode** %10
br label %184
179: ; preds = %58, %49
%180 = call i8* (...) @dlerror()
%181 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0), i8* %180)
%182 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.17, i64 0, i64 0))
%183 = call i32 @exit(i32 1)
unreachable
184: ; preds = %175
%185 = load i8*, i8** %7
%186 = call i32 @dlclose(i8* %185)
%187 = load i32, i32* %3
ret i32 %187
}

LLVM IR (-O2):
%struct.QRcode = type { i32, i32, i8* }
@.str = [18 x i8] c"Usage: %s 'text'\0A\00"
@.str.2 = [17 x i8] c"libqrencode.so.3\00"
@RTLD_NOW = global i32 0
@RTLD_LOCAL = global i32 0
@.str.3 = [17 x i8] c"libqrencode.so.4\00"
@.str.4 = [12 x i8] c"dlopen: %s\0A\00"
@.str.6 = [24 x i8] c"QRcode_encodeString8bit\00"
@.str.7 = [12 x i8] c"QRcode_free\00"
@.str.8 = [12 x i8] c"\1B[30;47;27m\00"
@.str.10 = [5 x i8] c"\1B[0m\00"
@.str.11 = [14 x i8] c"\1B[30;47;27m \00"
@.str.12 = [4 x i8] c"\E2\96\88\00"
@.str.13 = [4 x i8] c"\E2\96\80\00"
@.str.14 = [4 x i8] c"\E2\96\84\00"
@.str.15 = [7 x i8] c" \1B[0m\00"
@.str.16 = [11 x i8] c"dlsym: %s\0A\00"
@str = [36 x i8] c"Make sure libqrencode is installed.\00"
@str.18 = [45 x i8] c"Make sure libqrencode is installed properly.\00"
@str.19 = [59 x i8] c"Creates TEXT-type QR-code for 'text' in UTF-8/ANSI output.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.19, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = load i32, i32* @RTLD_NOW
%13 = load i32, i32* @RTLD_LOCAL
%14 = or i32 %13, %12
%15 = tail call i8* @dlopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %14)
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %28
17: ; preds = %9
%18 = load i32, i32* @RTLD_NOW
%19 = load i32, i32* @RTLD_LOCAL
%20 = or i32 %19, %18
%21 = tail call i8* @dlopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %20)
%22 = icmp eq i8* %21, null
br i1 %22, label %23, label %28
23: ; preds = %17
%24 = tail call i8* (...) @dlerror()
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %24)
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%27 = tail call i32 @exit(i32 1)
unreachable
28: ; preds = %9, %17
%29 = phi i8* [ %21, %17 ], [ %15, %9 ]
%30 = tail call i64 @dlsym(i8* %29, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%31 = tail call i64 @dlsym(i8* %29, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
%32 = icmp ne i64 %30, 0
%33 = icmp ne i64 %31, 0
%34 = select i1 %32, i1 %33, i1 false
br i1 %34, label %35, label %118
35: ; preds = %28
%36 = inttoptr i64 %30 to %struct.QRcode* (i8*, i32, i32)*
%37 = tail call %struct.QRcode* %36(i8* %11, i32 0, i32 1)
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
%39 = getelementptr inbounds %struct.QRcode, %struct.QRcode* %37, i64 0, i32 1
%40 = load i32, i32* %39
%41 = icmp sgt i32 %40, -4
br i1 %41, label %48, label %42
42: ; preds = %48, %35
%43 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
%44 = load i32, i32* %39
%45 = icmp sgt i32 %44, 0
br i1 %45, label %46, label %55
46: ; preds = %42
%47 = getelementptr inbounds %struct.QRcode, %struct.QRcode* %37, i64 0, i32 2
br label %59
48: ; preds = %35, %48
%49 = phi i32 [ %51, %48 ], [ 0, %35 ]
%50 = tail call i32 @putchar(i32 32)
%51 = add nuw nsw i32 %49, 1
%52 = load i32, i32* %39
%53 = add nsw i32 %52, 3
%54 = icmp slt i32 %49, %53
br i1 %54, label %48, label %42
55: ; preds = %66, %42
%56 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
%57 = load i32, i32* %39
%58 = icmp sgt i32 %57, -4
br i1 %58, label %111, label %107
59: ; preds = %46, %66
%60 = phi i32 [ 0, %46 ], [ %68, %66 ]
%61 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0))
%62 = load i32, i32* %39
%63 = icmp sgt i32 %62, 0
br i1 %63, label %64, label %66
64: ; preds = %59
%65 = or i32 %60, 1
br label %71
66: ; preds = %103, %59
%67 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i64 0, i64 0))
%68 = add nuw nsw i32 %60, 2
%69 = load i32, i32* %39
%70 = icmp slt i32 %68, %69
br i1 %70, label %59, label %55
71: ; preds = %64, %103
%72 = phi i32 [ %62, %64 ], [ %105, %103 ]
%73 = phi i32 [ 0, %64 ], [ %104, %103 ]
%74 = load i8*, i8** %47
%75 = mul nsw i32 %72, %60
%76 = add nsw i32 %75, %73
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i8, i8* %74, i64 %77
%79 = load i8, i8* %78
%80 = and i8 %79, 1
%81 = icmp slt i32 %65, %72
br i1 %81, label %82, label %91
82: ; preds = %71
%83 = mul nsw i32 %72, %65
%84 = add nsw i32 %83, %73
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds i8, i8* %74, i64 %85
%87 = load i8, i8* %86
%88 = and i8 %87, 1
%89 = icmp eq i8 %80, 0
%90 = icmp eq i8 %88, 0
br i1 %89, label %98, label %93
91: ; preds = %71
%92 = icmp eq i8 %80, 0
br i1 %92, label %101, label %96
93: ; preds = %82
br i1 %90, label %96, label %94
94: ; preds = %93
%95 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0))
br label %103
96: ; preds = %91, %93
%97 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0))
br label %103
98: ; preds = %82
br i1 %90, label %101, label %99
99: ; preds = %98
%100 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0))
br label %103
101: ; preds = %91, %98
%102 = tail call i32 @putchar(i32 32)
br label %103
103: ; preds = %99, %101, %94, %96
%104 = add nuw nsw i32 %73, 1
%105 = load i32, i32* %39
%106 = icmp slt i32 %104, %105
br i1 %106, label %71, label %66
107: ; preds = %111, %55
%108 = inttoptr i64 %31 to void (%struct.QRcode*)*
%109 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
tail call void %108(%struct.QRcode* %37)
%110 = tail call i32 @dlclose(i8* %29)
ret i32 0
111: ; preds = %55, %111
%112 = phi i32 [ %114, %111 ], [ 0, %55 ]
%113 = tail call i32 @putchar(i32 32)
%114 = add nuw nsw i32 %112, 1
%115 = load i32, i32* %39
%116 = add nsw i32 %115, 3
%117 = icmp slt i32 %112, %116
br i1 %117, label %111, label %107
118: ; preds = %28
%119 = tail call i8* (...) @dlerror()
%120 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0), i8* %119)
%121 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.18, i64 0, i64 0))
%122 = tail call i32 @exit(i32 1)
unreachable
}