#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 */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  scalar_t__ type;
};
typedef TYPE_1__ XEvent;
typedef int /*<<< orphan*/ Window;
typedef int /*<<< orphan*/ GC;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
int BlackPixel(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ DefaultRootWindow(int /*<<< orphan*/ *);
int /*<<< orphan*/ DefaultScreen(int /*<<< orphan*/ *);
scalar_t__ MapNotify;
int /*<<< orphan*/ StructureNotifyMask;
int WhitePixel(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ XCreateGC(int /*<<< orphan*/ *, int /*<<< orphan*/,
                             int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ XCreateSimpleWindow(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                       int /*<<< orphan*/, int /*<<< orphan*/,
                                       int, int, int /*<<< orphan*/, int, int);
int /*<<< orphan*/ XMapWindow(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ XNextEvent(int /*<<< orphan*/ *, TYPE_1__ *);
int /*<<< orphan*/ *XOpenDisplay(int /*<<< orphan*/ *);
int /*<<< orphan*/ XSelectInput(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                int /*<<< orphan*/);
int /*<<< orphan*/ affiche(int /*<<< orphan*/ *, int /*<<< orphan*/,
                           int /*<<< orphan*/, unsigned char *);
int /*<<< orphan*/ blackout(unsigned char *);
int /*<<< orphan*/ creeCarre(int, int, int, int, unsigned char *);
int /*<<< orphan*/ creeCercle(int, int, int, unsigned char *);
int /*<<< orphan*/ creeCercleTrigo(int, int, int, unsigned char *);
int /*<<< orphan*/ dessine(int /*<<< orphan*/ *, int /*<<< orphan*/,
                           int /*<<< orphan*/, int);
int /*<<< orphan*/ sleep(int);
int main() {
  unsigned char pic[200 * 200];
  blackout(pic);
  XEvent e;
  Display *dpy = XOpenDisplay(NULL);
  int noir = BlackPixel(dpy, DefaultScreen(dpy));
  int blanc = WhitePixel(dpy, DefaultScreen(dpy));
  Window w = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0, 200, 200, 0,
                                 noir, noir);
  XMapWindow(dpy, w);
  GC gc = XCreateGC(dpy, w, 0, NULL);
  XSelectInput(dpy, w, StructureNotifyMask);
  while (e.type != MapNotify)
    XNextEvent(dpy, &e);
  dessine(dpy, w, gc, blanc);
  creeCarre(10, 10, 42, 69, pic);
  creeCercle(100, 100, 100, pic);
  int i;
  for (i = 10; i <= 200; i += 30) {
    creeCercle(150, 150, i, pic);
    creeCercleTrigo(50, 150, i, pic);
  }
  affiche(dpy, w, gc, pic);
  sleep(10);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x9cb0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x9c50(%rbp),%rdi
call   1080 <blackout@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1070 <XOpenDisplay@plt>
mov    %rax,-0x9c60(%rbp)
mov    -0x9c60(%rbp),%rax
mov    %rax,-0x9c90(%rbp)
mov    -0x9c60(%rbp),%rdi
call   1120 <DefaultScreen@plt>
mov    -0x9c90(%rbp),%rdi
mov    %eax,%esi
call   10e0 <BlackPixel@plt>
mov    %eax,-0x9c64(%rbp)
mov    -0x9c60(%rbp),%rax
mov    %rax,-0x9c88(%rbp)
mov    -0x9c60(%rbp),%rdi
call   1120 <DefaultScreen@plt>
mov    -0x9c88(%rbp),%rdi
mov    %eax,%esi
call   1050 <WhitePixel@plt>
mov    %eax,-0x9c68(%rbp)
mov    -0x9c60(%rbp),%rax
mov    %rax,-0x9c80(%rbp)
mov    -0x9c60(%rbp),%rdi
call   1040 <DefaultRootWindow@plt>
mov    -0x9c80(%rbp),%rdi
mov    %eax,%esi
mov    -0x9c64(%rbp),%r10d
mov    -0x9c64(%rbp),%eax
xor    %ecx,%ecx
mov    $0xc8,%r9d
mov    %ecx,%edx
mov    %r9d,%r8d
movl   $0x0,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   10d0 <XCreateSimpleWindow@plt>
mov    %eax,-0x9c6c(%rbp)
mov    -0x9c60(%rbp),%rdi
mov    -0x9c6c(%rbp),%esi
call   1110 <XMapWindow@plt>
mov    -0x9c60(%rbp),%rdi
mov    -0x9c6c(%rbp),%esi
xor    %edx,%edx
xor    %eax,%eax
mov    %eax,%ecx
call   10c0 <XCreateGC@plt>
mov    %eax,-0x9c70(%rbp)
mov    -0x9c60(%rbp),%rdi
mov    -0x9c6c(%rbp),%esi
mov    0x2ca2(%rip),%rax
mov    (%rax),%edx
call   10b0 <XSelectInput@plt>
mov    -0x9c58(%rbp),%rax
mov    0x2c9d(%rip),%rcx
cmp    (%rcx),%rax
je     136c <main+0x15c>
mov    -0x9c60(%rbp),%rdi
lea    -0x9c58(%rbp),%rsi
call   10a0 <XNextEvent@plt>
jmp    133d <main+0x12d>
mov    -0x9c60(%rbp),%rdi
mov    -0x9c6c(%rbp),%esi
mov    -0x9c70(%rbp),%edx
mov    -0x9c68(%rbp),%ecx
call   1030 <dessine@plt>
lea    -0x9c50(%rbp),%r8
mov    $0xa,%esi
mov    $0x2a,%edx
mov    $0x45,%ecx
mov    %esi,%edi
call   1060 <creeCarre@plt>
lea    -0x9c50(%rbp),%rcx
mov    $0x64,%edx
mov    %edx,%edi
mov    %edx,%esi
call   1100 <creeCercle@plt>
movl   $0xa,-0x9c74(%rbp)
cmpl   $0xc8,-0x9c74(%rbp)
jg     141f <main+0x20f>
mov    -0x9c74(%rbp),%edx
lea    -0x9c50(%rbp),%rcx
mov    $0x96,%esi
mov    %esi,%edi
call   1100 <creeCercle@plt>
mov    -0x9c74(%rbp),%edx
lea    -0x9c50(%rbp),%rcx
mov    $0x32,%edi
mov    $0x96,%esi
call   10f0 <creeCercleTrigo@plt>
mov    -0x9c74(%rbp),%eax
add    $0x1e,%eax
mov    %eax,-0x9c74(%rbp)
jmp    13c6 <main+0x1b6>
mov    -0x9c60(%rbp),%rdi
mov    -0x9c6c(%rbp),%esi
mov    -0x9c70(%rbp),%edx
lea    -0x9c50(%rbp),%rcx
call   1090 <affiche@plt>
mov    $0xa,%edi
call   1130 <sleep@plt>
xor    %eax,%eax
add    $0x9cb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x9c58,%rsp
lea    0x10(%rsp),%rdi
call   1080 <blackout@plt>
xor    %edi,%edi
call   1070 <XOpenDisplay@plt>
mov    %rax,%r13
mov    %rax,%rdi
call   1120 <DefaultScreen@plt>
mov    %r13,%rdi
mov    %eax,%esi
call   10e0 <BlackPixel@plt>
mov    %eax,%ebp
mov    %r13,%rdi
call   1120 <DefaultScreen@plt>
mov    %r13,%rdi
mov    %eax,%esi
call   1050 <WhitePixel@plt>
mov    %eax,%r12d
mov    %r13,%rdi
call   1040 <DefaultRootWindow@plt>
sub    $0x8,%rsp
mov    %r13,%rdi
mov    %eax,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    $0xc8,%r8d
mov    $0xc8,%r9d
push   %rbp
push   %rbp
push   $0x0
call   10d0 <XCreateSimpleWindow@plt>
add    $0x20,%rsp
mov    %eax,%r15d
mov    %r13,%rdi
mov    %eax,%esi
call   1110 <XMapWindow@plt>
mov    %r13,%rdi
mov    %r15d,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   10c0 <XCreateGC@plt>
mov    %eax,%r14d
mov    0x2d26(%rip),%rax
mov    (%rax),%edx
mov    %r13,%rdi
mov    %r15d,%esi
call   10b0 <XSelectInput@plt>
lea    0x8(%rsp),%rbp
mov    0x2d1d(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %rbp,%rsi
call   10a0 <XNextEvent@plt>
mov    0x8(%rsp),%rax
cmp    (%rbx),%rax
jne    12d0 <main+0xc0>
mov    %r13,%rdi
mov    %r15d,%esi
mov    %r14d,%edx
mov    %r12d,%ecx
call   1030 <dessine@plt>
lea    0x10(%rsp),%rbp
mov    $0xa,%edi
mov    $0xa,%esi
mov    $0x2a,%edx
mov    $0x45,%ecx
mov    %rbp,%r8
call   1060 <creeCarre@plt>
mov    $0x64,%edi
mov    $0x64,%esi
mov    $0x64,%edx
mov    %rbp,%rcx
call   1100 <creeCercle@plt>
mov    $0x96,%edi
mov    $0x96,%esi
mov    $0xa,%edx
mov    %rbp,%rcx
call   1100 <creeCercle@plt>
mov    $0x32,%edi
mov    $0x96,%esi
mov    $0xa,%edx
mov    %rbp,%rcx
call   10f0 <creeCercleTrigo@plt>
mov    $0x96,%edi
mov    $0x96,%esi
mov    $0x28,%edx
mov    %rbp,%rcx
call   1100 <creeCercle@plt>
mov    $0x32,%edi
mov    $0x96,%esi
mov    $0x28,%edx
mov    %rbp,%rcx
call   10f0 <creeCercleTrigo@plt>
mov    $0x96,%edi
mov    $0x96,%esi
mov    $0x46,%edx
mov    %rbp,%rcx
call   1100 <creeCercle@plt>
mov    $0x32,%edi
mov    $0x96,%esi
mov    $0x46,%edx
mov    %rbp,%rcx
call   10f0 <creeCercleTrigo@plt>
mov    $0x96,%edi
mov    $0x96,%esi
mov    $0x64,%edx
mov    %rbp,%rcx
call   1100 <creeCercle@plt>
mov    $0x32,%edi
mov    $0x96,%esi
mov    $0x64,%edx
mov    %rbp,%rcx
call   10f0 <creeCercleTrigo@plt>
mov    $0x96,%edi
mov    $0x96,%esi
mov    $0x82,%edx
mov    %rbp,%rcx
call   1100 <creeCercle@plt>
mov    $0x32,%edi
mov    $0x96,%esi
mov    $0x82,%edx
mov    %rbp,%rcx
call   10f0 <creeCercleTrigo@plt>
mov    $0x96,%edi
mov    $0x96,%esi
mov    $0xa0,%edx
mov    %rbp,%rcx
call   1100 <creeCercle@plt>
mov    $0x32,%edi
mov    $0x96,%esi
mov    $0xa0,%edx
mov    %rbp,%rcx
call   10f0 <creeCercleTrigo@plt>
mov    $0x96,%edi
mov    $0x96,%esi
mov    $0xbe,%edx
mov    %rbp,%rcx
call   1100 <creeCercle@plt>
mov    $0x32,%edi
mov    $0x96,%esi
mov    $0xbe,%edx
mov    %rbp,%rcx
call   10f0 <creeCercleTrigo@plt>
mov    %r13,%rdi
mov    %r15d,%esi
mov    %r14d,%edx
mov    %rbp,%rcx
call   1090 <affiche@plt>
mov    $0xa,%edi
call   1130 <sleep@plt>
xor    %eax,%eax
add    $0x9c58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i64 }
@StructureNotifyMask = global i32 0
@MapNotify = global i64 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [40000 x i8]
%3 = alloca %struct.TYPE_3__
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
%10 = getelementptr inbounds [40000 x i8], [40000 x i8]* %2, i64 0, i64 0
%11 = call i32 @blackout(i8* %10)
%12 = call i32* @XOpenDisplay(i32* null)
store i32* %12, i32** %4
%13 = load i32*, i32** %4
%14 = load i32*, i32** %4
%15 = call i32 @DefaultScreen(i32* %14)
%16 = call i32 @BlackPixel(i32* %13, i32 %15)
store i32 %16, i32* %5
%17 = load i32*, i32** %4
%18 = load i32*, i32** %4
%19 = call i32 @DefaultScreen(i32* %18)
%20 = call i32 @WhitePixel(i32* %17, i32 %19)
store i32 %20, i32* %6
%21 = load i32*, i32** %4
%22 = load i32*, i32** %4
%23 = call i32 @DefaultRootWindow(i32* %22)
%24 = load i32, i32* %5
%25 = load i32, i32* %5
%26 = call i32 @XCreateSimpleWindow(i32* %21, i32 %23, i32 0, i32 0, i32 200, i32 200, i32 0, i32 %24, i32 %25)
store i32 %26, i32* %7
%27 = load i32*, i32** %4
%28 = load i32, i32* %7
%29 = call i32 @XMapWindow(i32* %27, i32 %28)
%30 = load i32*, i32** %4
%31 = load i32, i32* %7
%32 = call i32 @XCreateGC(i32* %30, i32 %31, i32 0, i32* null)
store i32 %32, i32* %8
%33 = load i32*, i32** %4
%34 = load i32, i32* %7
%35 = load i32, i32* @StructureNotifyMask
%36 = call i32 @XSelectInput(i32* %33, i32 %34, i32 %35)
br label %37
37: ; preds = %42, %0
%38 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 0
%39 = load i64, i64* %38
%40 = load i64, i64* @MapNotify
%41 = icmp ne i64 %39, %40
br i1 %41, label %42, label %45
42: ; preds = %37
%43 = load i32*, i32** %4
%44 = call i32 @XNextEvent(i32* %43, %struct.TYPE_3__* %3)
br label %37
45: ; preds = %37
%46 = load i32*, i32** %4
%47 = load i32, i32* %7
%48 = load i32, i32* %8
%49 = load i32, i32* %6
%50 = call i32 @dessine(i32* %46, i32 %47, i32 %48, i32 %49)
%51 = getelementptr inbounds [40000 x i8], [40000 x i8]* %2, i64 0, i64 0
%52 = call i32 @creeCarre(i32 10, i32 10, i32 42, i32 69, i8* %51)
%53 = getelementptr inbounds [40000 x i8], [40000 x i8]* %2, i64 0, i64 0
%54 = call i32 @creeCercle(i32 100, i32 100, i32 100, i8* %53)
store i32 10, i32* %9
br label %55
55: ; preds = %65, %45
%56 = load i32, i32* %9
%57 = icmp sle i32 %56, 200
br i1 %57, label %58, label %68
58: ; preds = %55
%59 = load i32, i32* %9
%60 = getelementptr inbounds [40000 x i8], [40000 x i8]* %2, i64 0, i64 0
%61 = call i32 @creeCercle(i32 150, i32 150, i32 %59, i8* %60)
%62 = load i32, i32* %9
%63 = getelementptr inbounds [40000 x i8], [40000 x i8]* %2, i64 0, i64 0
%64 = call i32 @creeCercleTrigo(i32 50, i32 150, i32 %62, i8* %63)
br label %65
65: ; preds = %58
%66 = load i32, i32* %9
%67 = add nsw i32 %66, 30
store i32 %67, i32* %9
br label %55
68: ; preds = %55
%69 = load i32*, i32** %4
%70 = load i32, i32* %7
%71 = load i32, i32* %8
%72 = getelementptr inbounds [40000 x i8], [40000 x i8]* %2, i64 0, i64 0
%73 = call i32 @affiche(i32* %69, i32 %70, i32 %71, i8* %72)
%74 = call i32 @sleep(i32 10)
ret i32 0
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i64 }
@StructureNotifyMask = global i32 0
@MapNotify = global i64 0
define i32 @main() {
%1 = alloca [40000 x i8]
%2 = alloca %struct.TYPE_3__
%3 = getelementptr inbounds [40000 x i8], [40000 x i8]* %1, i64 0, i64 0
%4 = call i32 @blackout(i8* %3)
%5 = bitcast %struct.TYPE_3__* %2 to i8*
%6 = call i32* @XOpenDisplay(i32* null)
%7 = call i32 @DefaultScreen(i32* %6)
%8 = call i32 @BlackPixel(i32* %6, i32 %7)
%9 = call i32 @DefaultScreen(i32* %6)
%10 = call i32 @WhitePixel(i32* %6, i32 %9)
%11 = call i32 @DefaultRootWindow(i32* %6)
%12 = call i32 @XCreateSimpleWindow(i32* %6, i32 %11, i32 0, i32 0, i32 200, i32 200, i32 0, i32 %8, i32 %8)
%13 = call i32 @XMapWindow(i32* %6, i32 %12)
%14 = call i32 @XCreateGC(i32* %6, i32 %12, i32 0, i32* null)
%15 = load i32, i32* @StructureNotifyMask
%16 = call i32 @XSelectInput(i32* %6, i32 %12, i32 %15)
%17 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %2, i64 0, i32 0
br label %18
18: ; preds = %0, %18
%19 = call i32 @XNextEvent(i32* %6, %struct.TYPE_3__* %2)
%20 = load i64, i64* %17
%21 = load i64, i64* @MapNotify
%22 = icmp eq i64 %20, %21
br i1 %22, label %23, label %18
23: ; preds = %18
%24 = call i32 @dessine(i32* %6, i32 %12, i32 %14, i32 %10)
%25 = call i32 @creeCarre(i32 10, i32 10, i32 42, i32 69, i8* %3)
%26 = call i32 @creeCercle(i32 100, i32 100, i32 100, i8* %3)
%27 = call i32 @creeCercle(i32 150, i32 150, i32 10, i8* %3)
%28 = call i32 @creeCercleTrigo(i32 50, i32 150, i32 10, i8* %3)
%29 = call i32 @creeCercle(i32 150, i32 150, i32 40, i8* %3)
%30 = call i32 @creeCercleTrigo(i32 50, i32 150, i32 40, i8* %3)
%31 = call i32 @creeCercle(i32 150, i32 150, i32 70, i8* %3)
%32 = call i32 @creeCercleTrigo(i32 50, i32 150, i32 70, i8* %3)
%33 = call i32 @creeCercle(i32 150, i32 150, i32 100, i8* %3)
%34 = call i32 @creeCercleTrigo(i32 50, i32 150, i32 100, i8* %3)
%35 = call i32 @creeCercle(i32 150, i32 150, i32 130, i8* %3)
%36 = call i32 @creeCercleTrigo(i32 50, i32 150, i32 130, i8* %3)
%37 = call i32 @creeCercle(i32 150, i32 150, i32 160, i8* %3)
%38 = call i32 @creeCercleTrigo(i32 50, i32 150, i32 160, i8* %3)
%39 = call i32 @creeCercle(i32 150, i32 150, i32 190, i8* %3)
%40 = call i32 @creeCercleTrigo(i32 50, i32 150, i32 190, i8* %3)
%41 = call i32 @affiche(i32* %6, i32 %12, i32 %14, i8* %3)
%42 = call i32 @sleep(i32 10)
ret i32 0
}