#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*/ Window;
typedef int /*<<< orphan*/ GC;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
int BlackPixel(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ DefaultScreen(int /*<<< orphan*/ *);
int WhitePixel(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ XDrawPoint(int /*<<< orphan*/ *, int /*<<< orphan*/,
                              int /*<<< orphan*/, int, int);
int /*<<< orphan*/ XFlush(int /*<<< orphan*/ *);
int /*<<< orphan*/ XSetForeground(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                  int);
void affiche(Display *dpy, Window w, GC gc, unsigned char *T) {
  int i, j;
  int blanc = WhitePixel(dpy, DefaultScreen(dpy));
  int noir = BlackPixel(dpy, DefaultScreen(dpy));
  for (i = 0; i < 200; i++) {
    for (j = 0; j < 200; j++) {
      XSetForeground(dpy, gc, (T[i + (j * 200)] == 1) ? blanc : noir);
      XDrawPoint(dpy, w, gc, i, j);
    }
  }
  XFlush(dpy);
}


x86 assembly (clang, -O0):
<affiche>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
call   1080 <DefaultScreen@plt>
mov    -0x38(%rbp),%rdi
mov    %eax,%esi
call   1040 <WhitePixel@plt>
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   1080 <DefaultScreen@plt>
mov    -0x30(%rbp),%rdi
mov    %eax,%esi
call   1050 <BlackPixel@plt>
mov    %eax,-0x28(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0xc8,-0x1c(%rbp)
jge    1261 <affiche+0x101>
movl   $0x0,-0x20(%rbp)
cmpl   $0xc8,-0x20(%rbp)
jge    124e <affiche+0xee>
mov    -0x8(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
imul   $0xc8,-0x20(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x1,%eax
jne    1215 <affiche+0xb5>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4c(%rbp)
jmp    121b <affiche+0xbb>
mov    -0x28(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x3c(%rbp),%esi
mov    -0x48(%rbp),%rdi
mov    -0x4c(%rbp),%edx
call   1060 <XSetForeground@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1030 <XDrawPoint@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11cf <affiche+0x6f>
jmp    1253 <affiche+0xf3>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11bb <affiche+0x5b>
mov    -0x8(%rbp),%rdi
call   1070 <XFlush@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<affiche>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,%r15
mov    %edx,%ebp
mov    %esi,0xc(%rsp)
mov    %rdi,%rbx
call   1080 <DefaultScreen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <WhitePixel@plt>
mov    %eax,%r12d
mov    %rbx,%rdi
call   1080 <DefaultScreen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <BlackPixel@plt>
mov    %eax,0x8(%rsp)
xor    %r14d,%r14d
jmp    11c6 <affiche+0x66>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r14
mov    0x10(%rsp),%r15
add    $0x1,%r15
cmp    $0xc8,%r14
je     1211 <affiche+0xb1>
mov    %r15,0x10(%rsp)
xor    %r13d,%r13d
jmp    1202 <affiche+0xa2>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1060 <XSetForeground@plt>
mov    %rbx,%rdi
mov    0xc(%rsp),%esi
mov    %ebp,%edx
mov    %r14d,%ecx
mov    %r13d,%r8d
call   1030 <XDrawPoint@plt>
add    $0x1,%r13
add    $0xc8,%r15
cmp    $0xc8,%r13
je     11b0 <affiche+0x50>
cmpb   $0x1,(%r15)
mov    %r12d,%edx
je     11d0 <affiche+0x70>
mov    0x8(%rsp),%edx
jmp    11d0 <affiche+0x70>
mov    %rbx,%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <XFlush@plt>

LLVM IR (-O0):
define void @affiche(i32* %0, i32 %1, i32 %2, i8* %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%13 = load i32*, i32** %5
%14 = load i32*, i32** %5
%15 = call i32 @DefaultScreen(i32* %14)
%16 = call i32 @WhitePixel(i32* %13, i32 %15)
store i32 %16, i32* %11
%17 = load i32*, i32** %5
%18 = load i32*, i32** %5
%19 = call i32 @DefaultScreen(i32* %18)
%20 = call i32 @BlackPixel(i32* %17, i32 %19)
store i32 %20, i32* %12
store i32 0, i32* %9
br label %21
21: ; preds = %58, %4
%22 = load i32, i32* %9
%23 = icmp slt i32 %22, 200
br i1 %23, label %24, label %61
24: ; preds = %21
store i32 0, i32* %10
br label %25
25: ; preds = %54, %24
%26 = load i32, i32* %10
%27 = icmp slt i32 %26, 200
br i1 %27, label %28, label %57
28: ; preds = %25
%29 = load i32*, i32** %5
%30 = load i32, i32* %7
%31 = load i8*, i8** %8
%32 = load i32, i32* %9
%33 = load i32, i32* %10
%34 = mul nsw i32 %33, 200
%35 = add nsw i32 %32, %34
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %31, i64 %36
%38 = load i8, i8* %37
%39 = zext i8 %38 to i32
%40 = icmp eq i32 %39, 1
br i1 %40, label %41, label %43
41: ; preds = %28
%42 = load i32, i32* %11
br label %45
43: ; preds = %28
%44 = load i32, i32* %12
br label %45
45: ; preds = %43, %41
%46 = phi i32 [ %42, %41 ], [ %44, %43 ]
%47 = call i32 @XSetForeground(i32* %29, i32 %30, i32 %46)
%48 = load i32*, i32** %5
%49 = load i32, i32* %6
%50 = load i32, i32* %7
%51 = load i32, i32* %9
%52 = load i32, i32* %10
%53 = call i32 @XDrawPoint(i32* %48, i32 %49, i32 %50, i32 %51, i32 %52)
br label %54
54: ; preds = %45
%55 = load i32, i32* %10
%56 = add nsw i32 %55, 1
store i32 %56, i32* %10
br label %25
57: ; preds = %25
br label %58
58: ; preds = %57
%59 = load i32, i32* %9
%60 = add nsw i32 %59, 1
store i32 %60, i32* %9
br label %21
61: ; preds = %21
%62 = load i32*, i32** %5
%63 = call i32 @XFlush(i32* %62)
ret void
}

LLVM IR (-O2):
define void @affiche(i32* %0, i32 %1, i32 %2, i8* nocapture %3) {
%5 = tail call i32 @DefaultScreen(i32* %0)
%6 = tail call i32 @WhitePixel(i32* %0, i32 %5)
%7 = tail call i32 @DefaultScreen(i32* %0)
%8 = tail call i32 @BlackPixel(i32* %0, i32 %7)
br label %9
9: ; preds = %4, %25
%10 = phi i64 [ 0, %4 ], [ %26, %25 ]
%11 = trunc i64 %10 to i32
br label %12
12: ; preds = %9, %12
%13 = phi i64 [ 0, %9 ], [ %23, %12 ]
%14 = mul nuw nsw i64 %13, 200
%15 = add nuw nsw i64 %14, %10
%16 = getelementptr inbounds i8, i8* %3, i64 %15
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 1
%19 = select i1 %18, i32 %6, i32 %8
%20 = tail call i32 @XSetForeground(i32* %0, i32 %2, i32 %19)
%21 = trunc i64 %13 to i32
%22 = tail call i32 @XDrawPoint(i32* %0, i32 %1, i32 %2, i32 %11, i32 %21)
%23 = add nuw nsw i64 %13, 1
%24 = icmp eq i64 %23, 200
br i1 %24, label %25, label %12
25: ; preds = %12
%26 = add nuw nsw i64 %10, 1
%27 = icmp eq i64 %26, 200
br i1 %27, label %28, label %9
28: ; preds = %25
%29 = tail call i32 @XFlush(i32* %0)
ret void
}