#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 */
typedef int /*<<< orphan*/ lineInsert;

/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char *, char *,
                            char *);
scalar_t__ system(char *);
int main(void) {
  char username[50];
  char password[50];
  char program[] = "./passweb";
  char command[] = "-verify";
  char lineInsert[256];
  printf("Username: ");
  scanf("%s", username);
  getchar();
  printf("Password: ");
  scanf("%s", password);
  getchar();
  snprintf(lineInsert, sizeof(lineInsert), "%s %s %s %s", program, command,
           username, password);
  if (system(lineInsert)) {
    printf("Verified!\n");
  } else {
    printf("Invalid!\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe97(%rip),%rax
mov    %rax,-0x8a(%rbp)
mov    0xe91(%rip),%ax
mov    %ax,-0x82(%rbp)
mov    0xe85(%rip),%rax
mov    %rax,-0x92(%rbp)
lea    0xe7f(%rip),%rdi
call   1040 <printf@plt>
lea    -0x40(%rbp),%rsi
lea    0xe8e(%rip),%rdi
call   1070 <scanf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
lea    0xe67(%rip),%rdi
call   1040 <printf@plt>
lea    -0x80(%rbp),%rsi
lea    0xe6b(%rip),%rdi
call   1070 <scanf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
lea    -0x1a0(%rbp),%rdi
lea    -0x8a(%rbp),%rcx
lea    -0x92(%rbp),%r8
lea    -0x40(%rbp),%r9
lea    -0x80(%rbp),%rax
mov    $0x100,%esi
lea    0xe2d(%rip),%rdx
mov    %rax,(%rsp)
call   1050 <snprintf@plt>
lea    -0x1a0(%rbp),%rdi
call   1030 <system@plt>
cmp    $0x0,%rax
je     122b <main+0xdb>
lea    0xe13(%rip),%rdi
call   1040 <printf@plt>
jmp    1237 <main+0xe7>
lea    0xe0d(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x1a0,%rsp
movabs $0x6577737361702f2e,%rax
73 77 65
mov    %rax,0x8(%rsp)
movw   $0x62,0x10(%rsp)
movabs $0x7966697265762d,%rax
mov    %rax,0x18(%rsp)
lea    0xe72(%rip),%rdi
call   1050 <printf@plt>
lea    0xe85(%rip),%r15
lea    0x60(%rsp),%r14
mov    %r15,%rdi
mov    %r14,%rsi
call   1080 <scanf@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
lea    0xe53(%rip),%rdi
call   1050 <printf@plt>
lea    0x20(%rsp),%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1080 <scanf@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
mov    %rbx,(%rsp)
lea    0xe37(%rip),%rdx
lea    0xa0(%rsp),%rbx
lea    0x8(%rsp),%rcx
lea    0x18(%rsp),%r8
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %r14,%r9
call   1060 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
test   %rax,%rax
lea    0xe0f(%rip),%rax
lea    0xe11(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x1a0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.program = [10 x i8] c"./passweb\00"
@__const.main.command = [8 x i8] c"-verify\00"
@.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 = [12 x i8] c"%s %s %s %s\00"
@.str.4 = [11 x i8] c"Verified!\0A\00"
@.str.5 = [10 x i8] c"Invalid!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [50 x i8]
%3 = alloca [50 x i8]
%4 = alloca [10 x i8]
%5 = alloca [8 x i8]
%6 = alloca [256 x i8]
store i32 0, i32* %1
%7 = bitcast [10 x i8]* %4 to i8*
%8 = bitcast [8 x i8]* %5 to i8*
%9 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = call i32 (...) @getchar()
%13 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%14 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = call i32 (...) @getchar()
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%18 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%19 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%20 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%21 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%22 = call i32 @snprintf(i8* %17, i32 256, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* %18, i8* %19, i8* %20, i8* %21)
%23 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%24 = call i64 @system(i8* %23)
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %0
%27 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br label %30
28: ; preds = %0
%29 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
br label %30
30: ; preds = %28, %26
ret i32 0
}

LLVM IR (-O2):
@__const.main.program = [10 x i8] c"./passweb\00"
@.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 = [12 x i8] c"%s %s %s %s\00"
@str = [9 x i8] c"Invalid!\00"
@str.6 = [10 x i8] c"Verified!\00"
define i32 @main() {
%1 = alloca [50 x i8]
%2 = alloca [50 x i8]
%3 = alloca [10 x i8]
%4 = alloca i64
%5 = alloca [256 x i8]
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%7 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%9 = bitcast i64* %4 to i8*
store i64 34171075258840621, i64* %4
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%11 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%13 = call i32 (...) @getchar()
%14 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%16 = call i32 (...) @getchar()
%17 = call i32 @snprintf(i8* %10, i32 256, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* %8, i8* %9, i8* %6, i8* %7)
%18 = call i64 @system(i8* %10)
%19 = icmp eq i64 %18, 0
%20 = select i1 %19, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @str.6, i64 0, i64 0)
%21 = call i32 @puts(i8* dereferenceable(1) %20)
ret i32 0
}