#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 /*<<< orphan*/ cng_close_font();
int /*<<< orphan*/ cng_current_color(int /*<<< orphan*/, int /*<<< orphan*/,
                                     int /*<<< orphan*/);
int /*<<< orphan*/ cng_current_color_index(int);
int /*<<< orphan*/ cng_draw_string(char *, int, int);
int cng_get_mouse_x();
int cng_get_mouse_y();
int /*<<< orphan*/ cng_open_font(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ sprintf(char *, char *, int, int);
int /*<<< orphan*/ stderr;
int bouton_0() {
  int x, y;
  unsigned char lr, lv, lb;
  char coord[256];
  fprintf(stderr, "Bouton 1 presse\n");
  x = cng_get_mouse_x();
  y = cng_get_mouse_y();
  cng_open_font("font2");
  sprintf(coord, "(%d,%d)", x, y);
  cng_current_color_index(5);
  cng_draw_string(coord, x, y);
  cng_close_font();
  cng_current_color(0, 0, 0);
}


x86 assembly (clang, -O0):
<bouton_0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
lea    0xe55(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x0,%al
call   10b0 <cng_get_mouse_x@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <cng_get_mouse_y@plt>
mov    %eax,-0xc(%rbp)
lea    0xe46(%rip),%rdi
call   1070 <cng_open_font@plt>
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe33(%rip),%rsi
call   10a0 <sprintf@plt>
mov    $0x5,%edi
call   1030 <cng_current_color_index@plt>
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1090 <cng_draw_string@plt>
mov    $0x0,%al
call   1060 <cng_close_font@plt>
xor    %edx,%edx
mov    %edx,%edi
mov    %edx,%esi
call   1080 <cng_current_color@plt>
mov    -0x4(%rbp),%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bouton_0>:
push   %rbp
push   %r14
push   %rbx
sub    $0x100,%rsp
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
lea    0xe55(%rip),%rsi
call   1050 <fprintf@plt>
xor    %eax,%eax
call   10b0 <cng_get_mouse_x@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <cng_get_mouse_y@plt>
mov    %eax,%ebp
lea    0xe48(%rip),%rdi
call   1070 <cng_open_font@plt>
lea    0xe42(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    %ebx,%edx
mov    %ebp,%ecx
call   10a0 <sprintf@plt>
mov    $0x5,%edi
call   1030 <cng_current_color_index@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
call   1090 <cng_draw_string@plt>
xor    %eax,%eax
call   1060 <cng_close_font@plt>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1080 <cng_current_color@plt>
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [17 x i8] c"Bouton 1 presse\0A\00"
@.str.1 = [6 x i8] c"font2\00"
@.str.2 = [8 x i8] c"(%d,%d)\00"
define i32 @bouton_0() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
%7 = alloca [256 x i8]
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (...) @cng_get_mouse_x()
store i32 %10, i32* %2
%11 = call i32 (...) @cng_get_mouse_y()
store i32 %11, i32* %3
%12 = call i32 @cng_open_font(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = call i32 @sprintf(i8* %13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %14, i32 %15)
%17 = call i32 @cng_current_color_index(i32 5)
%18 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = call i32 @cng_draw_string(i8* %18, i32 %19, i32 %20)
%22 = call i32 (...) @cng_close_font()
%23 = call i32 @cng_current_color(i32 0, i32 0, i32 0)
%24 = load i32, i32* %1
ret i32 %24
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [17 x i8] c"Bouton 1 presse\0A\00"
@.str.1 = [6 x i8] c"font2\00"
@.str.2 = [8 x i8] c"(%d,%d)\00"
define i32 @bouton_0() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 (...) @cng_get_mouse_x()
%6 = tail call i32 (...) @cng_get_mouse_y()
%7 = tail call i32 @cng_open_font(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 %6)
%9 = tail call i32 @cng_current_color_index(i32 5)
%10 = call i32 @cng_draw_string(i8* %2, i32 %5, i32 %6)
%11 = call i32 (...) @cng_close_font()
%12 = call i32 @cng_current_color(i32 0, i32 0, i32 0)
ret i32 undef
}