#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 */
struct msscene {
  int dummy;
};

/* Variables and functions */
double atof(char *);
int /*<<< orphan*/ set_error1(char *);
int /*<<< orphan*/ sphere_command(char *, double, double, double, double);
int parse_sphere(struct msscene *ms, int n_words, char words[16][64]) {
  double x, y, z, r;
  if (n_words != 6) {
    set_error1("invalid sphere command");
    return (0);
  }
  x = atof(words[2]);
  y = atof(words[3]);
  z = atof(words[4]);
  r = atof(words[5]);
  sphere_command(words[1], x, y, z, r);
  return (1);
}


x86 assembly (clang, -O0):
<parse_sphere>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
cmpl   $0x6,-0x14(%rbp)
je     1165 <parse_sphere+0x35>
lea    0xeac(%rip),%rdi
call   1050 <set_error1@plt>
movl   $0x0,-0x4(%rbp)
jmp    11e1 <parse_sphere+0xb1>
mov    -0x20(%rbp),%rdi
add    $0x80,%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
add    $0xc0,%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
add    $0x100,%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
add    $0x140,%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x40(%rbp)
mov    -0x20(%rbp),%rdi
add    $0x40,%rdi
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm3
call   1040 <sphere_command@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_sphere>:
push   %rbx
sub    $0x20,%rsp
cmp    $0x6,%esi
jne    11a7 <parse_sphere+0x77>
mov    %rdx,%rbx
lea    0x80(%rdx),%rdi
call   1030 <atof@plt>
movsd  %xmm0,0x18(%rsp)
lea    0xc0(%rbx),%rdi
call   1030 <atof@plt>
movsd  %xmm0,0x10(%rsp)
lea    0x100(%rbx),%rdi
call   1030 <atof@plt>
movsd  %xmm0,0x8(%rsp)
lea    0x140(%rbx),%rdi
call   1030 <atof@plt>
movaps %xmm0,%xmm3
add    $0x40,%rbx
mov    %rbx,%rdi
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
call   1040 <sphere_command@plt>
mov    $0x1,%eax
jmp    11b5 <parse_sphere+0x85>
lea    0xe52(%rip),%rdi
call   1050 <set_error1@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.msscene = type { i32 }
@.str = [23 x i8] c"invalid sphere command\00"
define i32 @parse_sphere(%struct.msscene* %0, i32 %1, [64 x i8]* %2) {
%4 = alloca i32
%5 = alloca %struct.msscene*
%6 = alloca i32
%7 = alloca [64 x i8]*
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
store %struct.msscene* %0, %struct.msscene** %5
store i32 %1, i32* %6
store [64 x i8]* %2, [64 x i8]** %7
%12 = load i32, i32* %6
%13 = icmp ne i32 %12, 6
br i1 %13, label %14, label %16
14: ; preds = %3
%15 = call i32 @set_error1(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %41
16: ; preds = %3
%17 = load [64 x i8]*, [64 x i8]** %7
%18 = getelementptr inbounds [64 x i8], [64 x i8]* %17, i64 2
%19 = getelementptr inbounds [64 x i8], [64 x i8]* %18, i64 0, i64 0
%20 = call double @atof(i8* %19)
store double %20, double* %8
%21 = load [64 x i8]*, [64 x i8]** %7
%22 = getelementptr inbounds [64 x i8], [64 x i8]* %21, i64 3
%23 = getelementptr inbounds [64 x i8], [64 x i8]* %22, i64 0, i64 0
%24 = call double @atof(i8* %23)
store double %24, double* %9
%25 = load [64 x i8]*, [64 x i8]** %7
%26 = getelementptr inbounds [64 x i8], [64 x i8]* %25, i64 4
%27 = getelementptr inbounds [64 x i8], [64 x i8]* %26, i64 0, i64 0
%28 = call double @atof(i8* %27)
store double %28, double* %10
%29 = load [64 x i8]*, [64 x i8]** %7
%30 = getelementptr inbounds [64 x i8], [64 x i8]* %29, i64 5
%31 = getelementptr inbounds [64 x i8], [64 x i8]* %30, i64 0, i64 0
%32 = call double @atof(i8* %31)
store double %32, double* %11
%33 = load [64 x i8]*, [64 x i8]** %7
%34 = getelementptr inbounds [64 x i8], [64 x i8]* %33, i64 1
%35 = getelementptr inbounds [64 x i8], [64 x i8]* %34, i64 0, i64 0
%36 = load double, double* %8
%37 = load double, double* %9
%38 = load double, double* %10
%39 = load double, double* %11
%40 = call i32 @sphere_command(i8* %35, double %36, double %37, double %38, double %39)
store i32 1, i32* %4
br label %41
41: ; preds = %16, %14
%42 = load i32, i32* %4
ret i32 %42
}

LLVM IR (-O2):
%struct.msscene = type { i32 }
@.str = [23 x i8] c"invalid sphere command\00"
define i32 @parse_sphere(%struct.msscene* nocapture readnone %0, i32 %1, [64 x i8]* %2) {
%4 = icmp eq i32 %1, 6
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @set_error1(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %18
7: ; preds = %3
%8 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 2, i64 0
%9 = tail call double @atof(i8* %8)
%10 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 3, i64 0
%11 = tail call double @atof(i8* %10)
%12 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 4, i64 0
%13 = tail call double @atof(i8* %12)
%14 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 5, i64 0
%15 = tail call double @atof(i8* %14)
%16 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 1, i64 0
%17 = tail call i32 @sphere_command(i8* %16, double %9, double %11, double %13, double %15)
br label %18
18: ; preds = %7, %5
%19 = phi i32 [ 0, %5 ], [ 1, %7 ]
ret i32 %19
}