#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 EXIT_SUCCESS;
char *malloc(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int system(char *);
int main(void) {
  char *username = malloc(sizeof(char) * 100);
  char *password = malloc(sizeof(char) * 1000);
  printf("Username: ");
  scanf("%s", username);
  printf("Password: ");
  scanf("%s", password);
  char *command = malloc(sizeof(char) * 1000);
  strcpy(command, "./passweb -verify ");
  strcat(command, username);
  strcat(command, " ");
  strcat(command, password);
  int returned = system(command);
  if (returned == EXIT_SUCCESS) {
    printf("Verified!\n");
  } else {
    printf("Invalid!\n");
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x64,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x3e8,%edi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
lea    0xe6e(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe69(%rip),%rdi
call   1070 <scanf@plt>
lea    0xe60(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xe4d(%rip),%rdi
call   1070 <scanf@plt>
mov    $0x3e8,%edi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe3d(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1080 <strcat@plt>
mov    -0x20(%rbp),%rdi
lea    0xe1e(%rip),%rsi
call   1080 <strcat@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1080 <strcat@plt>
mov    -0x20(%rbp),%rdi
call   1040 <system@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    0x2dbf(%rip),%rcx
cmp    (%rcx),%eax
jne    123a <main+0xda>
lea    0xdfc(%rip),%rdi
call   1050 <printf@plt>
jmp    1246 <main+0xe6>
lea    0xdf6(%rip),%rdi
call   1050 <printf@plt>
mov    0x2d93(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    $0x64,%edi
call   1070 <malloc@plt>
mov    %rax,%r12
mov    $0x3e8,%edi
call   1070 <malloc@plt>
mov    %rax,%r14
lea    0xe67(%rip),%rdi
call   1060 <printf@plt>
lea    0xe66(%rip),%r15
mov    %r15,%rdi
mov    %r12,%rsi
call   1080 <scanf@plt>
lea    0xe57(%rip),%rdi
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1080 <scanf@plt>
mov    $0x3e8,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
lea    0xe3e(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1090 <strcat@plt>
lea    0xe22(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1090 <strcat@plt>
mov    %rbx,%rdi
call   1050 <system@plt>
mov    0x2dc9(%rip),%rbx
cmp    (%rbx),%eax
lea    0xe15(%rip),%rax
lea    0xe05(%rip),%rdi
cmove  %rax,%rdi
call   1040 <puts@plt>
mov    (%rbx),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [11 x i8] c"Username: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [11 x i8] c"Password: \00"
@.str.3 = [19 x i8] c"./passweb -verify \00"
@.str.4 = [2 x i8] c" \00"
@EXIT_SUCCESS = global i32 0
@.str.5 = [11 x i8] c"Verified!\0A\00"
@.str.6 = [10 x i8] c"Invalid!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i32 0, i32* %1
%6 = call i8* @malloc(i32 100)
store i8* %6, i8** %2
%7 = call i8* @malloc(i32 1000)
store i8* %7, i8** %3
%8 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%9 = load i8*, i8** %2
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%12 = load i8*, i8** %3
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = call i8* @malloc(i32 1000)
store i8* %14, i8** %4
%15 = load i8*, i8** %4
%16 = call i32 @strcpy(i8* %15, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%17 = load i8*, i8** %4
%18 = load i8*, i8** %2
%19 = call i32 @strcat(i8* %17, i8* %18)
%20 = load i8*, i8** %4
%21 = call i32 @strcat(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%22 = load i8*, i8** %4
%23 = load i8*, i8** %3
%24 = call i32 @strcat(i8* %22, i8* %23)
%25 = load i8*, i8** %4
%26 = call i32 @system(i8* %25)
store i32 %26, i32* %5
%27 = load i32, i32* %5
%28 = load i32, i32* @EXIT_SUCCESS
%29 = icmp eq i32 %27, %28
br i1 %29, label %30, label %32
30: ; preds = %0
%31 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
br label %34
32: ; preds = %0
%33 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
br label %34
34: ; preds = %32, %30
%35 = load i32, i32* @EXIT_SUCCESS
ret i32 %35
}

LLVM IR (-O2):
@.str = [11 x i8] c"Username: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [11 x i8] c"Password: \00"
@.str.3 = [19 x i8] c"./passweb -verify \00"
@.str.4 = [2 x i8] c" \00"
@EXIT_SUCCESS = global i32 0
@str = [9 x i8] c"Invalid!\00"
@str.7 = [10 x i8] c"Verified!\00"
define i32 @main() {
%1 = tail call dereferenceable_or_null(100) i8* @malloc(i32 100)
%2 = tail call dereferenceable_or_null(1000) i8* @malloc(i32 1000)
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%7 = tail call dereferenceable_or_null(1000) i8* @malloc(i32 1000)
%8 = tail call i32 @strcpy(i8* %7, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%9 = tail call i32 @strcat(i8* %7, i8* %1)
%10 = tail call i32 @strcat(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%11 = tail call i32 @strcat(i8* %7, i8* %2)
%12 = tail call i32 @system(i8* %7)
%13 = load i32, i32* @EXIT_SUCCESS
%14 = icmp eq i32 %12, %13
%15 = select i1 %14, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @str.7, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0)
%16 = tail call i32 @puts(i8* dereferenceable(1) %15)
%17 = load i32, i32* @EXIT_SUCCESS
ret i32 %17
}