#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 atoi(char *);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int enterData(int f) {
  int data = 0;
  char str[100];
  if (f == 0)
    printf("\nEnter integer:");
  else
    printf("\nEnter position:");
  scanf("%s", str);
  getchar();
  data = atoi(str);
  return data;
}


x86 assembly (clang, -O0):
<enterData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    116d <enterData+0x2d>
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
jmp    1179 <enterData+0x39>
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xe9d(%rip),%rdi
call   1050 <scanf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
lea    -0x70(%rbp),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<enterData>:
push   %rbx
sub    $0x70,%rsp
test   %edi,%edi
lea    0xeb2(%rip),%rax
lea    0xebb(%rip),%rdi
cmove  %rax,%rdi
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %rbx,%rdi
call   1060 <atoi@plt>
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"\0AEnter integer:\00"
@.str.1 = [17 x i8] c"\0AEnter position:\00"
@.str.2 = [3 x i8] c"%s\00"
define i32 @enterData(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [100 x i8]
store i32 %0, i32* %2
store i32 0, i32* %3
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %11
9: ; preds = %1
%10 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %7
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %12)
%14 = call i32 (...) @getchar()
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%16 = call i32 @atoi(i8* %15)
store i32 %16, i32* %3
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@.str = [16 x i8] c"\0AEnter integer:\00"
@.str.1 = [17 x i8] c"\0AEnter position:\00"
@.str.2 = [3 x i8] c"%s\00"
define i32 @enterData(i32 %0) {
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%4 = icmp eq i32 %0, 0
%5 = select i1 %4, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0)
%6 = tail call i32 @printf(i8* dereferenceable(1) %5)
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%8 = call i32 (...) @getchar()
%9 = call i32 @atoi(i8* %3)
ret i32 %9
}