#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*/ printf(char *);
int /*<<< orphan*/ write_port(char *);
void uicontrol_zmereno(int q) {
  char msgqq[12] = "ahoj";
  static int stav = -1;
  if (q != stav) {
    if (q == 1) {
      msgqq[0] = '\x90';
      write_port(msgqq);
    } else {
      printf("x");
      msgqq[0] = 10;
      printf("y");
      write_port(msgqq);
      printf("z");
    }
    stav = q;
  }
}


x86 assembly (clang, -O0):
<uicontrol_zmereno>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xecc(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    0x2ee8(%rip),%eax
je     11a4 <uicontrol_zmereno+0x84>
cmpl   $0x1,-0x4(%rbp)
jne    116a <uicontrol_zmereno+0x4a>
movb   $0x90,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
call   1040 <write_port@plt>
jmp    119b <uicontrol_zmereno+0x7b>
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
movb   $0xa,-0x10(%rbp)
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
lea    -0x10(%rbp),%rdi
call   1040 <write_port@plt>
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,0x2e8c(%rip)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uicontrol_zmereno>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0x8(%rsp)
movq   $0x6a6f6861,(%rsp)
6a
cmp    %edi,0x2ef5(%rip)
je     1182 <uicontrol_zmereno+0x62>
mov    %edi,%ebx
cmp    $0x1,%edi
jne    1152 <uicontrol_zmereno+0x32>
movb   $0x90,(%rsp)
mov    %rsp,%rdi
call   1040 <write_port@plt>
jmp    117c <uicontrol_zmereno+0x5c>
mov    $0x78,%edi
call   1030 <putchar@plt>
movb   $0xa,(%rsp)
mov    $0x79,%edi
call   1030 <putchar@plt>
mov    %rsp,%rdi
call   1040 <write_port@plt>
mov    $0x7a,%edi
call   1030 <putchar@plt>
mov    %ebx,0x2eae(%rip)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.uicontrol_zmereno.msgqq = [12 x i8] c"ahoj\00\00\00\00\00\00\00\00"
@uicontrol_zmereno.stav = internal global i32 -1
@.str = [2 x i8] c"x\00"
@.str.1 = [2 x i8] c"y\00"
@.str.2 = [2 x i8] c"z\00"
define void @uicontrol_zmereno(i32 %0) {
%2 = alloca i32
%3 = alloca [12 x i8]
store i32 %0, i32* %2
%4 = bitcast [12 x i8]* %3 to i8*
%5 = load i32, i32* %2
%6 = load i32, i32* @uicontrol_zmereno.stav
%7 = icmp ne i32 %5, %6
br i1 %7, label %8, label %24
8: ; preds = %1
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
store i8 -112, i8* %12
%13 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%14 = call i32 @write_port(i8* %13)
br label %22
15: ; preds = %8
%16 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%17 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
store i8 10, i8* %17
%18 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%19 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%20 = call i32 @write_port(i8* %19)
%21 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %22
22: ; preds = %15, %11
%23 = load i32, i32* %2
store i32 %23, i32* @uicontrol_zmereno.stav
br label %24
24: ; preds = %22, %1
ret void
}

LLVM IR (-O2):
@__const.uicontrol_zmereno.msgqq = [12 x i8] c"ahoj\00\00\00\00\00\00\00\00"
@uicontrol_zmereno.stav = internal unnamed_addr global i32 -1
define void @uicontrol_zmereno(i32 %0) {
%2 = alloca [12 x i8]
%3 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%4 = load i32, i32* @uicontrol_zmereno.stav
%5 = icmp eq i32 %4, %0
br i1 %5, label %16, label %6
6: ; preds = %1
%7 = icmp eq i32 %0, 1
br i1 %7, label %8, label %10
8: ; preds = %6
store i8 -112, i8* %3
%9 = call i32 @write_port(i8* %3)
br label %15
10: ; preds = %6
%11 = tail call i32 @putchar(i32 120)
store i8 10, i8* %3
%12 = tail call i32 @putchar(i32 121)
%13 = call i32 @write_port(i8* %3)
%14 = call i32 @putchar(i32 122)
br label %15
15: ; preds = %10, %8
store i32 %0, i32* @uicontrol_zmereno.stav
br label %16
16: ; preds = %15, %1
ret void
}