#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 */
typedef int ssize_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int struct_calcsize(char *);
void test_struct_example_3_3(void) {
  ssize_t res1, res2;
  res1 = struct_calcsize("ci");
  res2 = struct_calcsize("ic");
  printf("Example 3.3 test: ");
  if (res1 == 8 && res2 == 5)
    printf("PASS\n");
  else
    printf("FAIL\n");
}


x86 assembly (clang, -O0):
<test_struct_example_3_3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <struct_calcsize@plt>
mov    %eax,-0x4(%rbp)
lea    0xec5(%rip),%rdi
call   1030 <struct_calcsize@plt>
mov    %eax,-0x8(%rbp)
lea    0xeb9(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0x8,-0x4(%rbp)
jne    1177 <test_struct_example_3_3+0x57>
cmpl   $0x5,-0x8(%rbp)
jne    1177 <test_struct_example_3_3+0x57>
lea    0xeac(%rip),%rdi
call   1040 <printf@plt>
jmp    1183 <test_struct_example_3_3+0x63>
lea    0xea1(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_struct_example_3_3>:
push   %rbp
push   %rbx
push   %rax
lea    0xec6(%rip),%rdi
call   1030 <struct_calcsize@plt>
mov    %eax,%ebx
lea    0xebb(%rip),%rdi
call   1030 <struct_calcsize@plt>
mov    %eax,%ebp
lea    0xeb0(%rip),%rdi
call   1050 <printf@plt>
xor    $0x8,%ebx
xor    $0x5,%ebp
lea    0xeb6(%rip),%rax
lea    0xeaa(%rip),%rdi
or     %ebx,%ebp
cmove  %rax,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"ci\00"
@.str.1 = [3 x i8] c"ic\00"
@.str.2 = [19 x i8] c"Example 3.3 test: \00"
@.str.3 = [6 x i8] c"PASS\0A\00"
@.str.4 = [6 x i8] c"FAIL\0A\00"
define void @test_struct_example_3_3() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @struct_calcsize(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %3, i32* %1
%4 = call i32 @struct_calcsize(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32 %4, i32* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%6 = load i32, i32* %1
%7 = icmp eq i32 %6, 8
br i1 %7, label %8, label %13
8: ; preds = %0
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 5
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %15
13: ; preds = %8, %0
%14 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %15
15: ; preds = %13, %11
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"ci\00"
@.str.1 = [3 x i8] c"ic\00"
@.str.2 = [19 x i8] c"Example 3.3 test: \00"
@str = [5 x i8] c"FAIL\00"
@str.5 = [5 x i8] c"PASS\00"
define void @test_struct_example_3_3() {
%1 = tail call i32 @struct_calcsize(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @struct_calcsize(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%4 = icmp eq i32 %1, 8
%5 = icmp eq i32 %2, 5
%6 = select i1 %4, i1 %5, i1 false
%7 = select i1 %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str.5, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0)
%8 = tail call i32 @puts(i8* dereferenceable(1) %7)
ret void
}