#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*/ _assert(int, char *, int);
int /*<<< orphan*/ exec(char *);
int /*<<< orphan*/ pause(double);
int login(int terminal) {
  pause(0.5);
  switch (terminal) {
  case 0:
    exec("login /dev/tty0");
    break;
  case 1:
    exec("login /dev/ttyS0");
    break;
  case 2:
    exec("login /dev/ttyS1");
    break;
  case 3:
    exec("login /dev/lp0");
    break;
  default:
    _assert(1,
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/fossum/wsu_cs460/refs/heads/master/"
            "final/init.c",
            94);
    break;
  }
}


x86 assembly (clang, -O0):
<login>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movsd  0xebd(%rip),%xmm0
call   1030 <pause@plt>
mov    -0x8(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x3,%rax
ja     11b1 <login+0x81>
mov    -0x10(%rbp),%rax
lea    0xea4(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xea4(%rip),%rdi
call   1050 <exec@plt>
jmp    11c7 <login+0x97>
lea    0xea3(%rip),%rdi
call   1050 <exec@plt>
jmp    11c7 <login+0x97>
lea    0xea3(%rip),%rdi
call   1050 <exec@plt>
jmp    11c7 <login+0x97>
lea    0xea3(%rip),%rdi
call   1050 <exec@plt>
jmp    11c7 <login+0x97>
mov    $0x1,%edi
lea    0xe9c(%rip),%rsi
mov    $0x5e,%edx
call   1040 <_assert@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<login>:
push   %rbx
mov    %edi,%ebx
movsd  0xec5(%rip),%xmm0
call   1030 <pause@plt>
cmp    $0x3,%ebx
ja     1160 <login+0x30>
mov    %ebx,%eax
lea    0xeba(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeba(%rip),%rdi
jmp    1191 <login+0x61>
lea    0xef2(%rip),%rsi
mov    $0x1,%edi
mov    $0x5e,%edx
call   1040 <_assert@plt>
pop    %rbx
ret
lea    0xea9(%rip),%rdi
jmp    1191 <login+0x61>
lea    0xeb1(%rip),%rdi
jmp    1191 <login+0x61>
lea    0xeb9(%rip),%rdi
call   1050 <exec@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"login /dev/tty0\00"
@.str.1 = [17 x i8] c"login /dev/ttyS0\00"
@.str.2 = [17 x i8] c"login /dev/ttyS1\00"
@.str.3 = [15 x i8] c"login /dev/lp0\00"
@.str.4 = [138 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fossum/wsu_cs460/refs/heads/master/final/init.c\00"
define i32 @login(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i32 @pause(double 5.000000e-01)
%5 = load i32, i32* %3
switch i32 %5, label %14 [
i32 0, label %6
i32 1, label %8
i32 2, label %10
i32 3, label %12
]
6: ; preds = %1
%7 = call i32 @exec(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %16
8: ; preds = %1
%9 = call i32 @exec(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %16
10: ; preds = %1
%11 = call i32 @exec(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %16
12: ; preds = %1
%13 = call i32 @exec(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %16
14: ; preds = %1
%15 = call i32 @_assert(i32 1, i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.4, i64 0, i64 0), i32 94)
br label %16
16: ; preds = %14, %12, %10, %8, %6
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
@.str = [16 x i8] c"login /dev/tty0\00"
@.str.1 = [17 x i8] c"login /dev/ttyS0\00"
@.str.2 = [17 x i8] c"login /dev/ttyS1\00"
@.str.3 = [15 x i8] c"login /dev/lp0\00"
@.str.4 = [138 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fossum/wsu_cs460/refs/heads/master/final/init.c\00"
define i32 @login(i32 %0) {
%2 = tail call i32 @pause(double 5.000000e-01)
switch i32 %0, label %11 [
i32 0, label %3
i32 1, label %5
i32 2, label %7
i32 3, label %9
]
3: ; preds = %1
%4 = tail call i32 @exec(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %13
5: ; preds = %1
%6 = tail call i32 @exec(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %13
7: ; preds = %1
%8 = tail call i32 @exec(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %13
9: ; preds = %1
%10 = tail call i32 @exec(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %13
11: ; preds = %1
%12 = tail call i32 @_assert(i32 1, i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.4, i64 0, i64 0), i32 94)
br label %13
13: ; preds = %11, %9, %7, %5, %3
ret i32 undef
}