#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*/ scanf(char *, int *);
void guess_the_number(const int ans) {
  printf("guess the number with 1 try\n");
  int guess;
  printf("Guess? ");
  scanf(" %d", &guess);
  if (guess == ans) {
    printf("You guessed correctly!\n");
  } else {
    printf("WRONG!\n");
  }
}


x86 assembly (clang, -O0):
<guess_the_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jne    1170 <guess_the_number+0x50>
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
jmp    117c <guess_the_number+0x5c>
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<guess_the_number>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb6(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb2(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
cmp    %ebx,0xc(%rsp)
lea    0xec4(%rip),%rax
lea    0xeb6(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"guess the number with 1 try\0A\00"
@.str.1 = [8 x i8] c"Guess? \00"
@.str.2 = [4 x i8] c" %d\00"
@.str.3 = [24 x i8] c"You guessed correctly!\0A\00"
@.str.4 = [8 x i8] c"WRONG!\0A\00"
define void @guess_the_number(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = load i32, i32* %2
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
br label %14
12: ; preds = %1
%13 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
br label %14
14: ; preds = %12, %10
ret void
}

LLVM IR (-O2):
@.str.1 = [8 x i8] c"Guess? \00"
@.str.2 = [4 x i8] c" %d\00"
@str = [28 x i8] c"guess the number with 1 try\00"
@str.5 = [7 x i8] c"WRONG!\00"
@str.6 = [23 x i8] c"You guessed correctly!\00"
define void @guess_the_number(i32 %0) {
%2 = alloca i32
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = icmp eq i32 %7, %0
%9 = select i1 %8, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @str.6, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @str.5, i64 0, i64 0)
%10 = call i32 @puts(i8* dereferenceable(1) %9)
ret void
}