#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*/ execve(char *, char **, char **);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
scalar_t__ fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ wait(int *);
void gpu_temp(void) {
  if (fork() == 0) {
    fprintf(stdout, "GPU ");
    fflush(stdout);
    char *argument[] = {"/opt/vc/bin/vcgencmd", "measure_temp", (char *)NULL};
    execve("/opt/vc/bin/vcgencmd", argument, (char **)NULL);
  }
  wait((int *)NULL);
}


x86 assembly (clang, -O0):
<gpu_temp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1070 <fork@plt>
cmp    $0x0,%rax
jne    11c1 <gpu_temp+0x71>
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
lea    0xe87(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    0x2c6d(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2c6a(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2c67(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x20(%rbp),%rsi
lea    0xe4d(%rip),%rdi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <execve@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <wait@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gpu_temp>:
push   %rbx
sub    $0x20,%rsp
xor    %eax,%eax
call   1070 <fork@plt>
test   %rax,%rax
jne    11a5 <gpu_temp+0x55>
mov    0x2e78(%rip),%rbx
mov    (%rbx),%edi
lea    0xe8f(%rip),%rsi
call   1040 <fprintf@plt>
mov    (%rbx),%edi
call   1050 <fflush@plt>
mov    0x2c8c(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0x2c70(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xe6a(%rip),%rdi
mov    %rsp,%rsi
xor    %edx,%edx
call   1030 <execve@plt>
xor    %edi,%edi
call   1060 <wait@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [5 x i8] c"GPU \00"
@.str.1 = [21 x i8] c"/opt/vc/bin/vcgencmd\00"
@.str.2 = [13 x i8] c"measure_temp\00"
@__const.gpu_temp.argument = [3 x i8*] [i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i32 0, i32 0), i8* null]
define void @gpu_temp() {
%1 = alloca [3 x i8*]
%2 = call i64 (...) @fork()
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %12
4: ; preds = %0
%5 = load i32, i32* @stdout
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @stdout
%8 = call i32 @fflush(i32 %7)
%9 = bitcast [3 x i8*]* %1 to i8*
%10 = getelementptr inbounds [3 x i8*], [3 x i8*]* %1, i64 0, i64 0
%11 = call i32 @execve(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8** %10, i8** null)
br label %12
12: ; preds = %4, %0
%13 = call i32 @wait(i32* null)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [5 x i8] c"GPU \00"
@.str.1 = [21 x i8] c"/opt/vc/bin/vcgencmd\00"
@.str.2 = [13 x i8] c"measure_temp\00"
@__const.gpu_temp.argument = [3 x i8*] [i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i32 0, i32 0), i8* null]
define void @gpu_temp() {
%1 = alloca [3 x i8*]
%2 = tail call i64 (...) @fork()
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %12
4: ; preds = %0
%5 = load i32, i32* @stdout
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @stdout
%8 = tail call i32 @fflush(i32 %7)
%9 = bitcast [3 x i8*]* %1 to i8*
%10 = getelementptr inbounds [3 x i8*], [3 x i8*]* %1, i64 0, i64 0
%11 = call i32 @execve(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8** %10, i8** null)
br label %12
12: ; preds = %4, %0
%13 = call i32 @wait(i32* null)
ret void
}