#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*/ mfm_drain_input();
int /*<<< orphan*/ printf(char *, char *);
int system(char *);
void mfm_command(char *comm) {
  int res;
  printf("%s", "\ec");
  res = system("stty sane;stty echo");
  res = system(comm);
  res = system("stty raw;stty -echo");
  printf("%s", "\e[1m\e[?25l");
  mfm_drain_input();
}


x86 assembly (clang, -O0):
<mfm_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xebd(%rip),%rdi
lea    0xeb9(%rip),%rsi
call   1040 <printf@plt>
lea    0xeb0(%rip),%rdi
call   1030 <system@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <system@plt>
mov    %eax,-0xc(%rbp)
lea    0xea9(%rip),%rdi
call   1030 <system@plt>
mov    %eax,-0xc(%rbp)
lea    0xe80(%rip),%rdi
lea    0xea7(%rip),%rsi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <mfm_drain_input@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mfm_command>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xec2(%rip),%r14
lea    0xebe(%rip),%rsi
mov    %r14,%rdi
call   1040 <printf@plt>
lea    0xeb2(%rip),%rdi
call   1030 <system@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
lea    0xeb2(%rip),%rdi
call   1030 <system@plt>
lea    0xeba(%rip),%rsi
mov    %r14,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <mfm_drain_input@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"\1Bc\00"
@.str.2 = [20 x i8] c"stty sane;stty echo\00"
@.str.3 = [20 x i8] c"stty raw;stty -echo\00"
@.str.4 = [11 x i8] c"\1B[1m\1B[?25l\00"
define void @mfm_command(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @system(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
store i32 %5, i32* %3
%6 = load i8*, i8** %2
%7 = call i32 @system(i8* %6)
store i32 %7, i32* %3
%8 = call i32 @system(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
store i32 %8, i32* %3
%9 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%10 = call i32 (...) @mfm_drain_input()
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"\1Bc\00"
@.str.2 = [20 x i8] c"stty sane;stty echo\00"
@.str.3 = [20 x i8] c"stty raw;stty -echo\00"
@.str.4 = [11 x i8] c"\1B[1m\1B[?25l\00"
define void @mfm_command(i8* nocapture %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @system(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @system(i8* %0)
%5 = tail call i32 @system(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%6 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%7 = tail call i32 (...) @mfm_drain_input()
ret void
}