#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*/ printf(char *, double, double);
int main(void) {
  struct complex_struct {
    double x, y;
  } z;
  double x = 3.0;
  z.x = x;
  z.y = 4.0;
  if (z.y < 0)
    printf("z=%f%fi\n", z.x, z.y);
  else
    printf("z=%f+%fi\n", z.x, z.y);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xee1(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xec2(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    116c <main+0x5c>
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
jmp    1182 <main+0x72>
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef8(%rip),%rdi
movsd  0xee0(%rip),%xmm0
movsd  0xee0(%rip),%xmm1
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.complex_struct = type { double, double }
@.str = [9 x i8] c"z=%f%fi\0A\00"
@.str.1 = [10 x i8] c"z=%f+%fi\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.complex_struct
%3 = alloca double
store i32 0, i32* %1
store double 3.000000e+00, double* %3
%4 = load double, double* %3
%5 = getelementptr inbounds %struct.complex_struct, %struct.complex_struct* %2, i32 0, i32 0
store double %4, double* %5
%6 = getelementptr inbounds %struct.complex_struct, %struct.complex_struct* %2, i32 0, i32 1
store double 4.000000e+00, double* %6
%7 = getelementptr inbounds %struct.complex_struct, %struct.complex_struct* %2, i32 0, i32 1
%8 = load double, double* %7
%9 = fcmp olt double %8, 0.000000e+00
br i1 %9, label %10, label %16
10: ; preds = %0
%11 = getelementptr inbounds %struct.complex_struct, %struct.complex_struct* %2, i32 0, i32 0
%12 = load double, double* %11
%13 = getelementptr inbounds %struct.complex_struct, %struct.complex_struct* %2, i32 0, i32 1
%14 = load double, double* %13
%15 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), double %12, double %14)
br label %22
16: ; preds = %0
%17 = getelementptr inbounds %struct.complex_struct, %struct.complex_struct* %2, i32 0, i32 0
%18 = load double, double* %17
%19 = getelementptr inbounds %struct.complex_struct, %struct.complex_struct* %2, i32 0, i32 1
%20 = load double, double* %19
%21 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double %18, double %20)
br label %22
22: ; preds = %16, %10
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [10 x i8] c"z=%f+%fi\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double 3.000000e+00, double 4.000000e+00)
ret i32 0
}