#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*/ SIGSTOP;
int /*<<< orphan*/ execve(char *, char **, char **);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ raise(int /*<<< orphan*/);
void do_child(char *executable) {
  char *new_argv[] = {executable, NULL, NULL, NULL};
  char *new_environ[] = {NULL};
  raise(SIGSTOP);
  execve(executable, new_argv, new_environ);
  perror("execve");
  exit(1);
}


x86 assembly (clang, -O0):
<do_child>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1040 <memset@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1040 <memset@plt>
mov    0x2e55(%rip),%rax
mov    (%rax),%edi
call   1030 <raise@plt>
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
lea    -0x38(%rbp),%rdx
call   1050 <execve@plt>
lea    0xe56(%rip),%rdi
call   1060 <perror@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<do_child>:
push   %rbx
sub    $0x30,%rsp
mov    %rdi,%rbx
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
mov    %rdi,0x10(%rsp)
movq   $0x0,0x8(%rsp)
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
call   1030 <raise@plt>
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
call   1040 <execve@plt>
lea    0xe76(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@SIGSTOP = global i32 0
@.str = [7 x i8] c"execve\00"
define void @do_child(i8* %0) {
%2 = alloca i8*
%3 = alloca [4 x i8*]
%4 = alloca [1 x i8*]
store i8* %0, i8** %2
%5 = bitcast [4 x i8*]* %3 to i8*
%6 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 0
%7 = load i8*, i8** %2
store i8* %7, i8** %6
%8 = getelementptr inbounds i8*, i8** %6, i64 1
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = bitcast [1 x i8*]* %4 to i8*
%12 = load i32, i32* @SIGSTOP
%13 = call i32 @raise(i32 %12)
%14 = load i8*, i8** %2
%15 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 0
%16 = getelementptr inbounds [1 x i8*], [1 x i8*]* %4, i64 0, i64 0
%17 = call i32 @execve(i8* %14, i8** %15, i8** %16)
%18 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@SIGSTOP = global i32 0
@.str = [7 x i8] c"execve\00"
define void @do_child(i8* %0) {
%2 = alloca [4 x i8*]
%3 = alloca [1 x i8*]
%4 = bitcast [4 x i8*]* %2 to i8*
%5 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 0
store i8* %0, i8** %5
%6 = bitcast [1 x i8*]* %3 to i8*
%7 = bitcast [1 x i8*]* %3 to i64*
store i64 0, i64* %7
%8 = load i32, i32* @SIGSTOP
%9 = tail call i32 @raise(i32 %8)
%10 = getelementptr inbounds [1 x i8*], [1 x i8*]* %3, i64 0, i64 0
%11 = call i32 @execve(i8* %0, i8** %5, i8** %10)
%12 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @exit(i32 1)
unreachable
}