#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*/ read_stdin_int(int *, char *, int /*<<< orphan*/);
int ask_user_schema(int *width, int *height, int *bombs) {
  printf("Genera lo schema\n");
  do {
    read_stdin_int(width, "Scegli il numero delle colonne:\n", 0);
  } while (*width < 1);
  do {
    read_stdin_int(height, "Scegli il numero delle righe:\n", 0);
  } while (*height < 1);
  do {
    read_stdin_int(bombs, "Scegli il numero delle bombe:\n", 0);
  } while (*bombs < 1);
  return 0;
}


x86 assembly (clang, -O0):
<ask_user_schema>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xec5(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    0xec7(%rip),%rsi
xor    %edx,%edx
call   1030 <read_stdin_int@plt>
mov    -0x8(%rbp),%rax
cmpl   $0x1,(%rax)
jl     1140 <ask_user_schema+0x20>
jmp    1164 <ask_user_schema+0x44>
mov    -0x10(%rbp),%rdi
lea    0xec4(%rip),%rsi
xor    %edx,%edx
call   1030 <read_stdin_int@plt>
mov    -0x10(%rbp),%rax
cmpl   $0x1,(%rax)
jl     1164 <ask_user_schema+0x44>
jmp    1188 <ask_user_schema+0x68>
mov    -0x18(%rbp),%rdi
lea    0xebf(%rip),%rsi
xor    %edx,%edx
call   1030 <read_stdin_int@plt>
mov    -0x18(%rbp),%rax
cmpl   $0x1,(%rax)
jl     1188 <ask_user_schema+0x68>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ask_user_schema>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xf27(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %edx,%edx
call   1040 <read_stdin_int@plt>
cmpl   $0x0,(%rbx)
jle    1150 <ask_user_schema+0x30>
lea    0xeb8(%rip),%rbx
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
call   1040 <read_stdin_int@plt>
cmpl   $0x0,(%r15)
jle    1170 <ask_user_schema+0x50>
lea    0xeb6(%rip),%rbx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
call   1040 <read_stdin_int@plt>
cmpl   $0x0,(%r14)
jle    1190 <ask_user_schema+0x70>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Genera lo schema\0A\00"
@.str.1 = [33 x i8] c"Scegli il numero delle colonne:\0A\00"
@.str.2 = [31 x i8] c"Scegli il numero delle righe:\0A\00"
@.str.3 = [31 x i8] c"Scegli il numero delle bombe:\0A\00"
define i32 @ask_user_schema(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %11, %3
%9 = load i32*, i32** %4
%10 = call i32 @read_stdin_int(i32* %9, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i32 0)
br label %11
11: ; preds = %8
%12 = load i32*, i32** %4
%13 = load i32, i32* %12
%14 = icmp slt i32 %13, 1
br i1 %14, label %8, label %15
15: ; preds = %11
br label %16
16: ; preds = %19, %15
%17 = load i32*, i32** %5
%18 = call i32 @read_stdin_int(i32* %17, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 0)
br label %19
19: ; preds = %16
%20 = load i32*, i32** %5
%21 = load i32, i32* %20
%22 = icmp slt i32 %21, 1
br i1 %22, label %16, label %23
23: ; preds = %19
br label %24
24: ; preds = %27, %23
%25 = load i32*, i32** %6
%26 = call i32 @read_stdin_int(i32* %25, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i32 0)
br label %27
27: ; preds = %24
%28 = load i32*, i32** %6
%29 = load i32, i32* %28
%30 = icmp slt i32 %29, 1
br i1 %30, label %24, label %31
31: ; preds = %27
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [33 x i8] c"Scegli il numero delle colonne:\0A\00"
@.str.2 = [31 x i8] c"Scegli il numero delle righe:\0A\00"
@.str.3 = [31 x i8] c"Scegli il numero delle bombe:\0A\00"
@str = [17 x i8] c"Genera lo schema\00"
define i32 @ask_user_schema(i32* %0, i32* %1, i32* %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br label %5
5: ; preds = %5, %3
%6 = tail call i32 @read_stdin_int(i32* %0, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i32 0)
%7 = load i32, i32* %0
%8 = icmp slt i32 %7, 1
br i1 %8, label %5, label %9
9: ; preds = %5, %9
%10 = tail call i32 @read_stdin_int(i32* %1, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 0)
%11 = load i32, i32* %1
%12 = icmp slt i32 %11, 1
br i1 %12, label %9, label %13
13: ; preds = %9, %13
%14 = tail call i32 @read_stdin_int(i32* %2, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i32 0)
%15 = load i32, i32* %2
%16 = icmp slt i32 %15, 1
br i1 %16, label %13, label %17
17: ; preds = %13
ret i32 0
}