#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*/ cmd;

/* Variables and functions */
int /*<<< orphan*/ dbg_msg(char *, char *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *, char const *);
int system(char *);
void gui_messagebox(const char *title, const char *message) {
  static char cmd[1024];
  int err;
  snprintf(cmd, sizeof(cmd), "xmessage -center -title '%s' '%s'", title,
           message);
  err = system(cmd);
  dbg_msg("gui/msgbox", "result = %i", err);
}


x86 assembly (clang, -O0):
<gui_messagebox>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%r8
lea    0x2f01(%rip),%rdi
mov    $0x400,%esi
lea    0xea5(%rip),%rdx
call   1040 <snprintf@plt>
lea    0x2ee9(%rip),%rdi
call   1030 <system@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edx
lea    0xea9(%rip),%rdi
lea    0xead(%rip),%rsi
call   1050 <dbg_msg@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gui_messagebox>:
push   %rbx
mov    %rsi,%r8
mov    %rdi,%rcx
lea    0x2f12(%rip),%rbx
lea    0xebb(%rip),%rdx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1040 <snprintf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
lea    0xec1(%rip),%rdi
lea    0xec5(%rip),%rsi
mov    %eax,%edx
pop    %rbx
jmp    1050 <dbg_msg@plt>

LLVM IR (-O0):
@gui_messagebox.cmd = internal global [1024 x i8] zeroinitializer
@.str = [34 x i8] c"xmessage -center -title '%s' '%s'\00"
@.str.1 = [11 x i8] c"gui/msgbox\00"
@.str.2 = [12 x i8] c"result = %i\00"
define void @gui_messagebox(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i32 @snprintf(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @gui_messagebox.cmd, i64 0, i64 0), i32 1024, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %7)
%9 = call i32 @system(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @gui_messagebox.cmd, i64 0, i64 0))
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = call i32 @dbg_msg(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %10)
ret void
}

LLVM IR (-O2):
@gui_messagebox.cmd = internal global [1024 x i8] zeroinitializer
@.str = [34 x i8] c"xmessage -center -title '%s' '%s'\00"
@.str.1 = [11 x i8] c"gui/msgbox\00"
@.str.2 = [12 x i8] c"result = %i\00"
define void @gui_messagebox(i8* %0, i8* %1) {
%3 = tail call i32 @snprintf(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @gui_messagebox.cmd, i64 0, i64 0), i32 1024, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%4 = tail call i32 @system(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @gui_messagebox.cmd, i64 0, i64 0))
%5 = tail call i32 @dbg_msg(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %4)
ret void
}