#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_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ cpu_temp();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ gpu_temp();
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strncmp(char *, char *, int);
int main(int argc, char **argv) {
  if (argc < 2) {
    cpu_temp();
    gpu_temp();
    exit(EXIT_SUCCESS);
  } else if (argc == 2) {
    if (!strncmp(argv[1], "cpu", 3))
      cpu_temp();
    else if (!strncmp(argv[1], "gpu", 3))
      gpu_temp();
    else {
      fprintf(stderr, "Usage: %s {cpu|gpu} \n", argv[0]);
      exit(EXIT_FAILURE);
    }
  }
}


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    118c <main+0x3c>
mov    $0x0,%al
call   1070 <cpu_temp@plt>
mov    $0x0,%al
call   1050 <gpu_temp@plt>
mov    0x2e4b(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
cmpl   $0x2,-0x8(%rbp)
jne    1226 <main+0xd6>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe5b(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    11c4 <main+0x74>
mov    $0x0,%al
call   1070 <cpu_temp@plt>
jmp    1221 <main+0xd1>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe31(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    11f2 <main+0xa2>
mov    $0x0,%al
call   1050 <gpu_temp@plt>
jmp    121c <main+0xcc>
mov    0x2de7(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdff(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2dc3(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
jmp    1221 <main+0xd1>
jmp    1226 <main+0xd6>
jmp    122b <main+0xdb>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x1,%edi
jle    11a4 <main+0x54>
cmp    $0x2,%edi
jne    11a0 <main+0x50>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe97(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1199 <main+0x49>
mov    0x8(%rbx),%rdi
lea    0xe82(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
jne    11c0 <main+0x70>
xor    %eax,%eax
call   1050 <gpu_temp@plt>
jmp    11a0 <main+0x50>
xor    %eax,%eax
call   1070 <cpu_temp@plt>
xor    %eax,%eax
pop    %rbx
ret
xor    %eax,%eax
call   1070 <cpu_temp@plt>
xor    %eax,%eax
call   1050 <gpu_temp@plt>
mov    0x2e17(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    0x2e19(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe35(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2df9(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
@.str = [4 x i8] c"cpu\00"
@.str.1 = [4 x i8] c"gpu\00"
@stderr = global i32 0
@.str.2 = [22 x i8] c"Usage: %s {cpu|gpu} \0A\00"
@EXIT_FAILURE = global i32 0
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 %13
8: ; preds = %2
%9 = call i32 (...) @cpu_temp()
%10 = call i32 (...) @gpu_temp()
%11 = load i32, i32* @EXIT_SUCCESS
%12 = call i32 @exit(i32 %11)
unreachable
13: ; preds = %2
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, 2
br i1 %15, label %16, label %42
16: ; preds = %13
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @strncmp(i8* %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%21 = icmp ne i32 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %16
%23 = call i32 (...) @cpu_temp()
br label %41
24: ; preds = %16
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i32 @strncmp(i8* %27, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%29 = icmp ne i32 %28, 0
br i1 %29, label %32, label %30
30: ; preds = %24
%31 = call i32 (...) @gpu_temp()
br label %40
32: ; preds = %24
%33 = load i32, i32* @stderr
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 0
%36 = load i8*, i8** %35
%37 = call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %36)
%38 = load i32, i32* @EXIT_FAILURE
%39 = call i32 @exit(i32 %38)
unreachable
40: ; preds = %30
br label %41
41: ; preds = %40, %22
br label %42
42: ; preds = %41, %13
br label %43
43: ; preds = %42
%44 = load i32, i32* %3
ret i32 %44
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@.str = [4 x i8] c"cpu\00"
@.str.1 = [4 x i8] c"gpu\00"
@stderr = global i32 0
@.str.2 = [22 x i8] c"Usage: %s {cpu|gpu} \0A\00"
@EXIT_FAILURE = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = tail call i32 (...) @cpu_temp()
%6 = tail call i32 (...) @gpu_temp()
%7 = load i32, i32* @EXIT_SUCCESS
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %2
%10 = icmp eq i32 %0, 2
br i1 %10, label %11, label %30
11: ; preds = %9
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i32 @strncmp(i8* %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = tail call i32 (...) @cpu_temp()
br label %30
18: ; preds = %11
%19 = load i8*, i8** %12
%20 = tail call i32 @strncmp(i8* %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = tail call i32 (...) @gpu_temp()
br label %30
24: ; preds = %18
%25 = load i32, i32* @stderr
%26 = load i8*, i8** %1
%27 = tail call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %26)
%28 = load i32, i32* @EXIT_FAILURE
%29 = tail call i32 @exit(i32 %28)
unreachable
30: ; preds = %9, %22, %16
ret i32 0
}