#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 /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ data;

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ getLabel(int /*<<< orphan*/ **, char *, int);
int getOrdinal(int /*<<< orphan*/ **);
int /*<<< orphan*/ printf(char *, int);
int skipStructEntry(uint8_t **data) {
  int ordinal = getOrdinal(data);
  char label[256];
  if (ordinal == 0)
    return 0;
  getLabel(data, label, sizeof(data));
  switch (ordinal) {
  case 1:
    *data += 1;
    break;
  case 2:
    *data += 2;
    break;
  case 3:
    *data += 4;
    break;
  case 5:
    *data += sizeof(float);
    break;
  case 13:
    while (skipStructEntry(data)) {
    };
    break;
  default:
    printf("Error - unknown datatype %d (or rather, i'm just lazy) in struct\n",
           ordinal);
    exit(0);
  }
  return 1;
}


x86 assembly (clang, -O0):
<skipStructEntry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <getOrdinal@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1181 <skipStructEntry+0x31>
movl   $0x0,-0x4(%rbp)
jmp    124f <skipStructEntry+0xff>
mov    -0x10(%rbp),%rdi
lea    -0x120(%rbp),%rsi
mov    $0x8,%edx
call   1050 <getLabel@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x128(%rbp)
sub    $0xc,%eax
ja     1232 <skipStructEntry+0xe2>
mov    -0x128(%rbp),%rax
lea    0xe44(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x4,%rcx
mov    %rcx,(%rax)
jmp    1248 <skipStructEntry+0xf8>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x8,%rcx
mov    %rcx,(%rax)
jmp    1248 <skipStructEntry+0xf8>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x10,%rcx
mov    %rcx,(%rax)
jmp    1248 <skipStructEntry+0xf8>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x10,%rcx
mov    %rcx,(%rax)
jmp    1248 <skipStructEntry+0xf8>
jmp    1216 <skipStructEntry+0xc6>
mov    -0x10(%rbp),%rdi
call   1070 <skipStructEntry@plt>
cmp    $0x0,%eax
je     122d <skipStructEntry+0xdd>
jmp    1216 <skipStructEntry+0xc6>
jmp    1248 <skipStructEntry+0xf8>
mov    -0x14(%rbp),%esi
lea    0xdf8(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skipStructEntry>:
push   %r14
push   %rbx
sub    $0x108,%rsp
mov    %rdi,%rbx
call   1040 <getOrdinal@plt>
test   %eax,%eax
je     11ae <skipStructEntry+0x5e>
mov    %eax,%r14d
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    $0x8,%edx
call   1050 <getLabel@plt>
lea    -0x1(%r14),%ecx
cmp    $0xc,%ecx
ja     11ce <skipStructEntry+0x7e>
mov    $0x1,%eax
lea    0xe72(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0x4,%eax
jmp    11b7 <skipStructEntry+0x67>
xchg   %ax,%ax
mov    %rbx,%rdi
call   1070 <skipStructEntry@plt>
test   %eax,%eax
jne    11a0 <skipStructEntry+0x50>
jmp    11be <skipStructEntry+0x6e>
xor    %eax,%eax
jmp    11c3 <skipStructEntry+0x73>
mov    $0x2,%eax
shl    $0x2,%rax
add    %rax,(%rbx)
mov    $0x1,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe5f(%rip),%rdi
mov    %r14d,%esi
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [66 x i8] c"Error - unknown datatype %d (or rather, i'm just lazy) in struct\0A\00"
define i32 @skipStructEntry(i32** %0) {
%2 = alloca i32
%3 = alloca i32**
%4 = alloca i32
%5 = alloca [256 x i8]
store i32** %0, i32*** %3
%6 = load i32**, i32*** %3
%7 = call i32 @getOrdinal(i32** %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 0, i32* %2
br label %44
11: ; preds = %1
%12 = load i32**, i32*** %3
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%14 = call i32 @getLabel(i32** %12, i8* %13, i32 8)
%15 = load i32, i32* %4
switch i32 %15, label %39 [
i32 1, label %16
i32 2, label %20
i32 3, label %24
i32 5, label %28
i32 13, label %32
]
16: ; preds = %11
%17 = load i32**, i32*** %3
%18 = load i32*, i32** %17
%19 = getelementptr inbounds i32, i32* %18, i64 1
store i32* %19, i32** %17
br label %43
20: ; preds = %11
%21 = load i32**, i32*** %3
%22 = load i32*, i32** %21
%23 = getelementptr inbounds i32, i32* %22, i64 2
store i32* %23, i32** %21
br label %43
24: ; preds = %11
%25 = load i32**, i32*** %3
%26 = load i32*, i32** %25
%27 = getelementptr inbounds i32, i32* %26, i64 4
store i32* %27, i32** %25
br label %43
28: ; preds = %11
%29 = load i32**, i32*** %3
%30 = load i32*, i32** %29
%31 = getelementptr inbounds i32, i32* %30, i64 4
store i32* %31, i32** %29
br label %43
32: ; preds = %11
br label %33
33: ; preds = %37, %32
%34 = load i32**, i32*** %3
%35 = call i32 @skipStructEntry(i32** %34)
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %33
br label %33
38: ; preds = %33
br label %43
39: ; preds = %11
%40 = load i32, i32* %4
%41 = call i32 @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0), i32 %40)
%42 = call i32 @exit(i32 0)
unreachable
43: ; preds = %38, %28, %24, %20, %16
store i32 1, i32* %2
br label %44
44: ; preds = %43, %10
%45 = load i32, i32* %2
ret i32 %45
}

LLVM IR (-O2):
@.str = [66 x i8] c"Error - unknown datatype %d (or rather, i'm just lazy) in struct\0A\00"
define i32 @skipStructEntry(i32** %0) {
%2 = alloca [256 x i8]
%3 = tail call i32 @getOrdinal(i32** %0)
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%5 = icmp eq i32 %3, 0
br i1 %5, label %21, label %6
6: ; preds = %1
%7 = call i32 @getLabel(i32** %0, i8* %4, i32 8)
switch i32 %3, label %14 [
i32 1, label %17
i32 2, label %8
i32 3, label %9
i32 5, label %10
i32 13, label %11
]
8: ; preds = %6
br label %17
9: ; preds = %6
br label %17
10: ; preds = %6
br label %17
11: ; preds = %6, %11
%12 = call i32 @skipStructEntry(i32** %0)
%13 = icmp eq i32 %12, 0
br i1 %13, label %21, label %11
14: ; preds = %6
%15 = call i32 @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0), i32 %3)
%16 = call i32 @exit(i32 0)
unreachable
17: ; preds = %6, %10, %9, %8
%18 = phi i64 [ 2, %8 ], [ 4, %9 ], [ 4, %10 ], [ 1, %6 ]
%19 = load i32*, i32** %0
%20 = getelementptr inbounds i32, i32* %19, i64 %18
store i32* %20, i32** %0
br label %21
21: ; preds = %11, %17, %1
%22 = phi i32 [ 0, %1 ], [ 1, %17 ], [ 1, %11 ]
ret i32 %22
}