#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, ...);
int /*<<< orphan*/ stderr;
void getdevice(char *device) {
  char buf[100];
  {
    if (*device == 0)
      sprintf(buf, "vogl: expected the enviroment variable VDEVICE to be set "
                   "to the desired device.\n");
    else
      sprintf(buf, "vogl: %s is an invalid device type\n", device);
    fputs(buf, stderr);
    fprintf(stderr, "The devices compiled into this library are:\n");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<getdevice>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1173 <getdevice+0x33>
lea    -0x70(%rbp),%rdi
lea    0xe99(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
jmp    1189 <getdevice+0x49>
lea    -0x70(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xecf(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
lea    -0x70(%rbp),%rdi
mov    0x2e4c(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
lea    0xeca(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<getdevice>:
push   %rbx
sub    $0x70,%rsp
cmpb   $0x0,(%rdi)
jne    118c <getdevice+0x4c>
movups 0xeef(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movups 0xed3(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movups 0xeb7(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movups 0xe9b(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movups 0xe7f(%rip),%xmm0
movaps %xmm0,(%rsp)
movb   $0x0,0x50(%rsp)
jmp    11a0 <getdevice+0x60>
mov    %rdi,%rdx
lea    0xebb(%rip),%rsi
mov    %rsp,%rdi
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    0x2e39(%rip),%rbx
mov    (%rbx),%esi
mov    %rsp,%rdi
call   1030 <fputs@plt>
mov    (%rbx),%edi
lea    0xebb(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [81 x i8] c"vogl: expected the enviroment variable VDEVICE to be set to the desired device.\0A\00"
@.str.1 = [36 x i8] c"vogl: %s is an invalid device type\0A\00"
@stderr = global i32 0
@.str.2 = [45 x i8] c"The devices compiled into this library are:\0A\00"
define void @getdevice(i8* %0) {
%2 = alloca i8*
%3 = alloca [100 x i8]
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%10 = call i32 (i8*, i8*, ...) @sprintf(i8* %9, i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str, i64 0, i64 0))
br label %15
11: ; preds = %1
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%13 = load i8*, i8** %2
%14 = call i32 (i8*, i8*, ...) @sprintf(i8* %12, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8* %13)
br label %15
15: ; preds = %11, %8
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%17 = load i32, i32* @stderr
%18 = call i32 @fputs(i8* %16, i32 %17)
%19 = load i32, i32* @stderr
%20 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0))
%21 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [81 x i8] c"vogl: expected the enviroment variable VDEVICE to be set to the desired device.\0A\00"
@.str.1 = [36 x i8] c"vogl: %s is an invalid device type\0A\00"
@stderr = global i32 0
@.str.2 = [45 x i8] c"The devices compiled into this library are:\0A\00"
define void @getdevice(i8* %0) {
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
br label %9
7: ; preds = %1
%8 = call i32 (i8*, i8*, ...) @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %9
9: ; preds = %7, %6
%10 = load i32, i32* @stderr
%11 = call i32 @fputs(i8* %3, i32 %10)
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
}