#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 *, char *);
scalar_t__ strcmp(char *, char *);
int login(void) {
  int buf = 0;
  char pass[16];
  char password[16] = "coep";
  printf("\n\t **** Welcome to Contact Management System ****");
  printf("\n\t\tEnter Password:");
  scanf("%[^\n]", pass);
  if (strcmp(pass, password) == 0)
    buf = 1;
  else
    printf("\n\nWrong Password!!\a\a\a");
  return buf;
}


x86 assembly (clang, -O0):
<login>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rsi
lea    0xedd(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x20(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11a0 <login+0x70>
movl   $0x1,-0x4(%rbp)
jmp    11ac <login+0x7c>
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<login>:
push   %rbx
sub    $0x20,%rsp
movaps 0xec4(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
lea    0xeef(%rip),%rdi
call   1030 <printf@plt>
lea    0xef6(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     118c <login+0x5c>
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
jmp    1191 <login+0x61>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.login.password = [16 x i8] c"coep\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [50 x i8] c"\0A\09 **** Welcome to Contact Management System ****\00"
@.str.1 = [19 x i8] c"\0A\09\09Enter Password:\00"
@.str.2 = [6 x i8] c"%[^\0A]\00"
@.str.3 = [22 x i8] c"\0A\0AWrong Password!!\07\07\07\00"
define i32 @login() {
%1 = alloca i32
%2 = alloca [16 x i8]
%3 = alloca [16 x i8]
store i32 0, i32* %1
%4 = bitcast [16 x i8]* %3 to i8*
%5 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%7 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%8 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%10 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%11 = call i64 @strcmp(i8* %9, i8* %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %0
store i32 1, i32* %1
br label %16
14: ; preds = %0
%15 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
br label %16
16: ; preds = %14, %13
%17 = load i32, i32* %1
ret i32 %17
}

LLVM IR (-O2):
@__const.login.password = [16 x i8] c"coep\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [50 x i8] c"\0A\09 **** Welcome to Contact Management System ****\00"
@.str.1 = [19 x i8] c"\0A\09\09Enter Password:\00"
@.str.2 = [6 x i8] c"%[^\0A]\00"
@.str.3 = [22 x i8] c"\0A\0AWrong Password!!\07\07\07\00"
define i32 @login() {
%1 = alloca [16 x i8]
%2 = alloca [16 x i8]
%3 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%8 = call i64 @strcmp(i8* %3, i8* %4)
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %0
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
br label %12
12: ; preds = %0, %10
%13 = phi i32 [ 0, %10 ], [ 1, %0 ]
ret i32 %13
}