#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*/ execlp(char *, char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  if (argc < 2) {
    printf("usage: primeselect intel|nvidia\n");
    return 0;
  }
  if (strcmp(argv[1], "intel") == 0) {
    printf("activate Intel GPU\n");
    execlp("prime-select", "prime-select", "intel", NULL);
    return 0;
  } else if (strcmp(argv[1], "nvidia") == 0) {
    printf("activate Nvidia GPU\n");
    execlp("prime-select", "prime-select", "nvidia", NULL);
    return 0;
  } else {
    printf("wrong argument:\nusage: primeselect intel|nvidia\n");
    return 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1168 <main+0x38>
lea    0xefc(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    121b <main+0xeb>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe89(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11b8 <main+0x88>
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
lea    0xe81(%rip),%rsi
lea    0xe60(%rip),%rdx
xor    %eax,%eax
mov    %eax,%ecx
mov    %rsi,%rdi
call   1050 <execlp@plt>
movl   $0x0,-0x4(%rbp)
jmp    121b <main+0xeb>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe60(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1208 <main+0xd8>
lea    0xe51(%rip),%rdi
call   1030 <printf@plt>
lea    0xe31(%rip),%rsi
lea    0xe37(%rip),%rdx
xor    %eax,%eax
mov    %eax,%ecx
mov    %rsi,%rdi
call   1050 <execlp@plt>
movl   $0x0,-0x4(%rbp)
jmp    121b <main+0xeb>
lea    0xe34(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x1,%edi
jg     113f <main+0xf>
lea    0xee6(%rip),%rdi
jmp    1173 <main+0x43>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xeb3(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     117a <main+0x4a>
mov    0x8(%rbx),%rdi
lea    0xeda(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1196 <main+0x66>
lea    0xea0(%rip),%rdi
call   1030 <puts@plt>
jmp    11ba <main+0x8a>
lea    0xed6(%rip),%rdi
call   1030 <puts@plt>
lea    0xe79(%rip),%rdi
lea    0xe6c(%rip),%rdx
jmp    11b0 <main+0x80>
lea    0xea6(%rip),%rdi
call   1030 <puts@plt>
lea    0xe5d(%rip),%rdi
lea    0xe8c(%rip),%rdx
mov    %rdi,%rsi
xor    %ecx,%ecx
call   1050 <execlp@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"usage: primeselect intel|nvidia\0A\00"
@.str.1 = [6 x i8] c"intel\00"
@.str.2 = [20 x i8] c"activate Intel GPU\0A\00"
@.str.3 = [13 x i8] c"prime-select\00"
@.str.4 = [7 x i8] c"nvidia\00"
@.str.5 = [21 x i8] c"activate Nvidia GPU\0A\00"
@.str.6 = [49 x i8] c"wrong argument:\0Ausage: primeselect intel|nvidia\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 2
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %30
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %10
%17 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 @execlp(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* null)
store i32 0, i32* %3
br label %30
19: ; preds = %10
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %19
%26 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%27 = call i32 @execlp(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32* null)
store i32 0, i32* %3
br label %30
28: ; preds = %19
%29 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %3
br label %30
30: ; preds = %28, %25, %16, %8
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"intel\00"
@.str.3 = [13 x i8] c"prime-select\00"
@.str.4 = [7 x i8] c"nvidia\00"
@str = [48 x i8] c"wrong argument:\0Ausage: primeselect intel|nvidia\00"
@str.7 = [20 x i8] c"activate Nvidia GPU\00"
@str.8 = [19 x i8] c"activate Intel GPU\00"
@str.9 = [32 x i8] c"usage: primeselect intel|nvidia\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.9, i64 0, i64 0))
br label %23
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %6
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.8, i64 0, i64 0))
%13 = tail call i32 @execlp(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* null)
br label %23
14: ; preds = %6
%15 = load i8*, i8** %7
%16 = tail call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %14
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.7, i64 0, i64 0))
%20 = tail call i32 @execlp(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32* null)
br label %23
21: ; preds = %14
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
br label %23
23: ; preds = %21, %18, %11, %4
ret i32 0
}