#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*/ O_RDWR;
int /*<<< orphan*/ close(int);
int open(char *, int /*<<< orphan*/);
int write(int, ...);
int mandaDimensioniEMascheraVisualizer(unsigned int r, unsigned int c,
                                       char maschera) {
  int ret = 0, pfd;
  if ((pfd = open("./tmp/visual.sck", O_RDWR)) != -1) {
    ret = (write(pfd, &r, sizeof(unsigned int)) != -1 &&
           write(pfd, &c, sizeof(unsigned int)) != -1 &&
           write(pfd, &maschera, sizeof(char)) != -1);
  }
  close(pfd);
  return ret;
}


x86 assembly (clang, -O0):
<mandaDimensioniEMascheraVisualizer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movl   $0x0,-0x10(%rbp)
mov    0x2e97(%rip),%rax
mov    (%rax),%esi
lea    0xea6(%rip),%rdi
call   1050 <open@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     11d8 <mandaDimensioniEMascheraVisualizer+0xa8>
mov    -0x14(%rbp),%edi
lea    -0x4(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1030 <write@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
mov    %al,-0x15(%rbp)
je     11cd <mandaDimensioniEMascheraVisualizer+0x9d>
mov    -0x14(%rbp),%edi
lea    -0x8(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1030 <write@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
mov    %al,-0x15(%rbp)
je     11cd <mandaDimensioniEMascheraVisualizer+0x9d>
mov    -0x14(%rbp),%edi
lea    -0x9(%rbp),%rsi
mov    $0x1,%edx
mov    $0x0,%al
call   1030 <write@plt>
cmp    $0xffffffff,%eax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <close@plt>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mandaDimensioniEMascheraVisualizer>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %edi,0x14(%rsp)
mov    %esi,0x10(%rsp)
mov    %dl,0xf(%rsp)
mov    0x2e9f(%rip),%rax
mov    (%rax),%esi
lea    0xeae(%rip),%rdi
call   1050 <open@plt>
mov    %eax,%ebx
xor    %ebp,%ebp
cmp    $0xffffffff,%eax
je     11ae <mandaDimensioniEMascheraVisualizer+0x7e>
lea    0x14(%rsp),%rsi
mov    $0x4,%edx
mov    %ebx,%edi
xor    %eax,%eax
call   1030 <write@plt>
cmp    $0xffffffff,%eax
je     11ae <mandaDimensioniEMascheraVisualizer+0x7e>
xor    %ebp,%ebp
lea    0x10(%rsp),%rsi
mov    $0x4,%edx
mov    %ebx,%edi
xor    %eax,%eax
call   1030 <write@plt>
cmp    $0xffffffff,%eax
je     11ae <mandaDimensioniEMascheraVisualizer+0x7e>
lea    0xf(%rsp),%rsi
mov    $0x1,%edx
mov    %ebx,%edi
xor    %eax,%eax
call   1030 <write@plt>
xor    %ebp,%ebp
cmp    $0xffffffff,%eax
setne  %bpl
mov    %ebx,%edi
call   1040 <close@plt>
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"./tmp/visual.sck\00"
@O_RDWR = global i32 0
define i32 @mandaDimensioniEMascheraVisualizer(i32 %0, i32 %1, i8 signext %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8 %2, i8* %6
store i32 0, i32* %7
%9 = load i32, i32* @O_RDWR
%10 = call i32 @open(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %9)
store i32 %10, i32* %8
%11 = icmp ne i32 %10, -1
br i1 %11, label %12, label %27
12: ; preds = %3
%13 = load i32, i32* %8
%14 = call i32 (i32, ...) @write(i32 %13, i32* %4, i64 4)
%15 = icmp ne i32 %14, -1
br i1 %15, label %16, label %24
16: ; preds = %12
%17 = load i32, i32* %8
%18 = call i32 (i32, ...) @write(i32 %17, i32* %5, i64 4)
%19 = icmp ne i32 %18, -1
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = load i32, i32* %8
%22 = call i32 (i32, ...) @write(i32 %21, i8* %6, i64 1)
%23 = icmp ne i32 %22, -1
br label %24
24: ; preds = %20, %16, %12
%25 = phi i1 [ false, %16 ], [ false, %12 ], [ %23, %20 ]
%26 = zext i1 %25 to i32
store i32 %26, i32* %7
br label %27
27: ; preds = %24, %3
%28 = load i32, i32* %8
%29 = call i32 @close(i32 %28)
%30 = load i32, i32* %7
ret i32 %30
}

LLVM IR (-O2):
@.str = [17 x i8] c"./tmp/visual.sck\00"
@O_RDWR = global i32 0
define i32 @mandaDimensioniEMascheraVisualizer(i32 %0, i32 %1, i8 signext %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8 %2, i8* %6
%7 = load i32, i32* @O_RDWR
%8 = tail call i32 @open(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = icmp eq i32 %8, -1
br i1 %9, label %20, label %10
10: ; preds = %3
%11 = call i32 (i32, ...) @write(i32 %8, i32* %4, i64 4)
%12 = icmp eq i32 %11, -1
br i1 %12, label %20, label %13
13: ; preds = %10
%14 = call i32 (i32, ...) @write(i32 %8, i32* %5, i64 4)
%15 = icmp eq i32 %14, -1
br i1 %15, label %20, label %16
16: ; preds = %13
%17 = call i32 (i32, ...) @write(i32 %8, i8* %6, i64 1)
%18 = icmp ne i32 %17, -1
%19 = zext i1 %18 to i32
br label %20
20: ; preds = %10, %13, %16, %3
%21 = phi i32 [ 0, %3 ], [ 0, %13 ], [ 0, %10 ], [ %19, %16 ]
%22 = call i32 @close(i32 %8)
ret i32 %21
}