xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
char *smtp_fill_in_addresses(char *source_string) {
  char *retval;
  retval = (char *)malloc(strlen(source_string) + 1);
  if (retval != NULL) {
    strcpy(retval, source_string);
  }
  return (retval);
}


x86 assembly (clang, -O0):
<smtp_fill_in_addresses>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     116d <smtp_fill_in_addresses+0x3d>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smtp_fill_in_addresses>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1158 <smtp_fill_in_addresses+0x28>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @smtp_fill_in_addresses(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 %5, 1
%7 = call i64 @malloc(i64 %6)
%8 = inttoptr i64 %7 to i8*
store i8* %8, i8** %3
%9 = load i8*, i8** %3
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %15
11: ; preds = %1
%12 = load i8*, i8** %3
%13 = load i8*, i8** %2
%14 = call i32 @strcpy(i8* %12, i8* %13)
br label %15
15: ; preds = %11, %1
%16 = load i8*, i8** %3
ret i8* %16
}

LLVM IR (-O2):
define i8* @smtp_fill_in_addresses(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i64 @malloc(i64 %3)
%5 = inttoptr i64 %4 to i8*
%6 = icmp eq i64 %4, 0
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = tail call i32 @strcpy(i8* %5, i8* %0)
br label %9
9: ; preds = %7, %1
ret i8* %5
}
int main(int argc, char *argv[]) {
  switch (argc) {
  case 0:
    return 4;
  case 1:
    return 5;
  case 2:
    return 4;
  case 3:
    return 3;
  case 4:
    return 2;
  case 5:
    return 7;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x5,%rax
ja     117f <main+0x7f>
mov    -0x18(%rbp),%rax
lea    0xed2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x4,-0x4(%rbp)
jmp    1186 <main+0x86>
movl   $0x5,-0x4(%rbp)
jmp    1186 <main+0x86>
movl   $0x4,-0x4(%rbp)
jmp    1186 <main+0x86>
movl   $0x3,-0x4(%rbp)
jmp    1186 <main+0x86>
movl   $0x2,-0x4(%rbp)
jmp    1186 <main+0x86>
movl   $0x7,-0x4(%rbp)
jmp    1186 <main+0x86>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
cmp    $0x5,%edi
ja     1114 <main+0x14>
movslq %edi,%rax
lea    0xeef(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
switch i32 %6, label %13 [
i32 0, label %7
i32 1, label %8
i32 2, label %9
i32 3, label %10
i32 4, label %11
i32 5, label %12
]
7: ; preds = %2
store i32 4, i32* %3
br label %14
8: ; preds = %2
store i32 5, i32* %3
br label %14
9: ; preds = %2
store i32 4, i32* %3
br label %14
10: ; preds = %2
store i32 3, i32* %3
br label %14
11: ; preds = %2
store i32 2, i32* %3
br label %14
12: ; preds = %2
store i32 7, i32* %3
br label %14
13: ; preds = %2
store i32 0, i32* %3
br label %14
14: ; preds = %13, %12, %11, %10, %9, %8, %7
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
@switch.table.main = [6 x i32] [i32 4, i32 5, i32 4, i32 3, i32 2, i32 7]
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = icmp ult i32 %0, 6
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = sext i32 %0 to i64
%6 = getelementptr inbounds [6 x i32], [6 x i32]* @switch.table.main, i64 0, i64 %5
%7 = load i32, i32* %6
br label %8
8: ; preds = %2, %4
%9 = phi i32 [ %7, %4 ], [ 0, %2 ]
ret i32 %9
}
/* Type definitions */
struct tm {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ date_time(struct tm *, struct tm *, int /*<<< orphan*/);
void date_midnight(struct tm *tm, struct tm *now, int *num) {
  date_time(tm, now, 0);
}


x86 assembly (clang, -O0):
<date_midnight>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %edx,%edx
call   1030 <date_time@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<date_midnight>:
xor    %edx,%edx
jmp    1030 <date_time@plt>

LLVM IR (-O0):
%struct.tm = type { i32 }
define void @date_midnight(%struct.tm* %0, %struct.tm* %1, i32* %2) {
%4 = alloca %struct.tm*
%5 = alloca %struct.tm*
%6 = alloca i32*
store %struct.tm* %0, %struct.tm** %4
store %struct.tm* %1, %struct.tm** %5
store i32* %2, i32** %6
%7 = load %struct.tm*, %struct.tm** %4
%8 = load %struct.tm*, %struct.tm** %5
%9 = call i32 @date_time(%struct.tm* %7, %struct.tm* %8, i32 0)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define void @date_midnight(%struct.tm* %0, %struct.tm* %1, i32* nocapture readnone %2) {
%4 = tail call i32 @date_time(%struct.tm* %0, %struct.tm* %1, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ g(int);
void o(int c) {
  while (c) {
    g(c);
    c = c / 256;
  }
}


x86 assembly (clang, -O0):
<o>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1140 <o+0x30>
mov    -0x4(%rbp),%edi
call   1030 <g@plt>
mov    -0x4(%rbp),%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    111b <o+0xb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<o>:
push   %rbx
test   %edi,%edi
je     113c <o+0x2c>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1030 <g@plt>
lea    0xff(%rbx),%eax
test   %ebx,%ebx
cmovs  %eax,%ebx
sar    $0x8,%ebx
cmp    $0x1fe,%eax
ja     1120 <o+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @o(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %6, %1
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = load i32, i32* %2
%8 = call i32 @g(i32 %7)
%9 = load i32, i32* %2
%10 = sdiv i32 %9, 256
store i32 %10, i32* %2
br label %3
11: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @o(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ %0, %1 ]
%5 = tail call i32 @g(i32 %4)
%6 = sdiv i32 %4, 256
%7 = add i32 %4, 255
%8 = icmp ult i32 %7, 511
br i1 %8, label %9, label %3
9: ; preds = %3, %1
ret void
}
/* Type definitions */
struct UPnPService {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void RNDResponseSink_AVTransport_Play(struct UPnPService *Service,
                                      int ErrorCode, void *User) {
  printf("RND Invoke Response: AVTransport/Play[ErrorCode:%d]()\r\n",
         ErrorCode);
}


x86 assembly (clang, -O0):
<RNDResponseSink_AVTransport_Play>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%esi
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RNDResponseSink_AVTransport_Play>:
lea    0xee9(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.UPnPService = type { i32 }
@.str = [56 x i8] c"RND Invoke Response: AVTransport/Play[ErrorCode:%d]()\0D\0A\00"
define void @RNDResponseSink_AVTransport_Play(%struct.UPnPService* %0, i32 %1, i8* %2) {
%4 = alloca %struct.UPnPService*
%5 = alloca i32
%6 = alloca i8*
store %struct.UPnPService* %0, %struct.UPnPService** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32, i32* %5
%8 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i32 %7)
ret void
}

LLVM IR (-O2):
%struct.UPnPService = type { i32 }
@.str = [56 x i8] c"RND Invoke Response: AVTransport/Play[ErrorCode:%d]()\0D\0A\00"
define void @RNDResponseSink_AVTransport_Play(%struct.UPnPService* nocapture readnone %0, i32 %1, i8* nocapture readnone %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
/* Variables and functions */
scalar_t__ strcmp(char *, char *);
int cmp_tag(char *token, char *str) {
  int t = 0;
  if (token == NULL)
    return 0;
  if (str == NULL)
    return 0;
  if (strcmp(token + t, str) != 0)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<cmp_tag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    113e <cmp_tag+0x2e>
movl   $0x0,-0x4(%rbp)
jmp    1186 <cmp_tag+0x76>
cmpq   $0x0,-0x18(%rbp)
jne    1155 <cmp_tag+0x45>
movl   $0x0,-0x4(%rbp)
jmp    1186 <cmp_tag+0x76>
mov    -0x10(%rbp),%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     117f <cmp_tag+0x6f>
movl   $0x0,-0x4(%rbp)
jmp    1186 <cmp_tag+0x76>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_tag>:
xor    %eax,%eax
test   %rdi,%rdi
je     1131 <cmp_tag+0x21>
test   %rsi,%rsi
je     1131 <cmp_tag+0x21>
push   %rax
call   1030 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
add    $0x8,%rsp
ret

LLVM IR (-O0):
define i32 @cmp_tag(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 0, i32* %6
%7 = load i8*, i8** %4
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 0, i32* %3
br label %24
10: ; preds = %2
%11 = load i8*, i8** %5
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %14
13: ; preds = %10
store i32 0, i32* %3
br label %24
14: ; preds = %10
%15 = load i8*, i8** %4
%16 = load i32, i32* %6
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8*, i8** %5
%20 = call i64 @strcmp(i8* %18, i8* %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %14
store i32 0, i32* %3
br label %24
23: ; preds = %14
store i32 1, i32* %3
br label %24
24: ; preds = %23, %22, %13, %9
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @cmp_tag(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
%4 = icmp eq i8* %1, null
%5 = or i1 %3, %4
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = tail call i64 @strcmp(i8* %0, i8* %1)
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %2
%11 = phi i32 [ 0, %2 ], [ %9, %6 ]
ret i32 %11
}
char *replaceCRLF2Space(char *s) {
  char *p = s;
  while (*p != '\0') {
    if (*p == '\r' || *p == '\n') {
      *p = ' ';
    }
    p++;
  }
  return s;
}


x86 assembly (clang, -O0):
<replaceCRLF2Space>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1158 <replaceCRLF2Space+0x58>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xd,%eax
je     1140 <replaceCRLF2Space+0x40>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    1147 <replaceCRLF2Space+0x47>
mov    -0x10(%rbp),%rax
movb   $0x20,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <replaceCRLF2Space+0x10>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<replaceCRLF2Space>:
mov    %rdi,%rax
mov    %rdi,%rcx
jmp    1117 <replaceCRLF2Space+0x17>
nopl   0x0(%rax,%rax,1)
movb   $0x20,(%rcx)
add    $0x1,%rcx
movzbl (%rcx),%edx
cmp    $0xa,%dl
je     1110 <replaceCRLF2Space+0x10>
cmp    $0xd,%dl
je     1110 <replaceCRLF2Space+0x10>
test   %dl,%dl
jne    1113 <replaceCRLF2Space+0x13>
ret

LLVM IR (-O0):
define i8* @replaceCRLF2Space(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
br label %5
5: ; preds = %22, %1
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %25
10: ; preds = %5
%11 = load i8*, i8** %3
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 13
br i1 %14, label %20, label %15
15: ; preds = %10
%16 = load i8*, i8** %3
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 10
br i1 %19, label %20, label %22
20: ; preds = %15, %10
%21 = load i8*, i8** %3
store i8 32, i8* %21
br label %22
22: ; preds = %20, %15
%23 = load i8*, i8** %3
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %3
br label %5
25: ; preds = %5
%26 = load i8*, i8** %2
ret i8* %26
}

LLVM IR (-O2):
define i8* @replaceCRLF2Space(i8* returned %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i8* [ %0, %1 ], [ %7, %6 ]
%4 = load i8, i8* %3
switch i8 %4, label %6 [
i8 0, label %8
i8 13, label %5
i8 10, label %5
]
5: ; preds = %2, %2
store i8 32, i8* %3
br label %6
6: ; preds = %2, %5
%7 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
8: ; preds = %2
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
int main() {
  float m = 1, n = 2, temp, s = 0;
  int i;
  for (i = 1; i <= 10; i++) {
    s += m / n;
    temp = m;
    m = n;
    n += temp;
  }
  printf("sum=%f\n", s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xedd(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xecc(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
cmpl   $0xa,-0x18(%rbp)
jg     1197 <main+0x87>
movss  -0x8(%rbp),%xmm0
divss  -0xc(%rbp),%xmm0
addss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x10(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1148 <main+0x38>
movss  -0x14(%rbp),%xmm0
lea    0xe65(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [8 x i8] c"sum=%f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca i32
store i32 0, i32* %1
store float 1.000000e+00, float* %2
store float 2.000000e+00, float* %3
store float 0.000000e+00, float* %5
store i32 1, i32* %6
br label %7
7: ; preds = %21, %0
%8 = load i32, i32* %6
%9 = icmp sle i32 %8, 10
br i1 %9, label %10, label %24
10: ; preds = %7
%11 = load float, float* %2
%12 = load float, float* %3
%13 = fdiv float %11, %12
%14 = load float, float* %5
%15 = fadd float %14, %13
store float %15, float* %5
%16 = load float, float* %2
store float %16, float* %4
%17 = load float, float* %3
store float %17, float* %2
%18 = load float, float* %4
%19 = load float, float* %3
%20 = fadd float %19, %18
store float %20, float* %3
br label %21
21: ; preds = %10
%22 = load i32, i32* %6
%23 = add nsw i32 %22, 1
store i32 %23, i32* %6
br label %7
24: ; preds = %7
%25 = load float, float* %5
%26 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), float %25)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"sum=%f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), float 0x4018645000000000)
ret i32 0
}
int FastIntSign(int x) {
  if (x > 0)
    return 1;
  else if (x < 0)
    return -1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<FastIntSign>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    111d <FastIntSign+0x1d>
movl   $0x1,-0x4(%rbp)
jmp    113a <FastIntSign+0x3a>
cmpl   $0x0,-0x8(%rbp)
jge    1133 <FastIntSign+0x33>
movl   $0xffffffff,-0x4(%rbp)
jmp    113a <FastIntSign+0x3a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FastIntSign>:
mov    %edi,%ecx
sar    $0x1f,%ecx
test   %edi,%edi
mov    $0x1,%eax
cmovle %ecx,%eax
ret

LLVM IR (-O0):
define i32 @FastIntSign(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 1, i32* %2
br label %12
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 -1, i32* %2
br label %12
11: ; preds = %7
store i32 0, i32* %2
br label %12
12: ; preds = %11, %10, %6
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
define i32 @FastIntSign(i32 %0) {
%2 = ashr i32 %0, 31
%3 = icmp slt i32 %0, 1
%4 = select i1 %3, i32 %2, i32 1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ expect_false_failed(int, char const *, int);
int /*<<< orphan*/ expectation_passed();
void _expect_false(int act, const char *file, int line) {
  if ((act) == 0)
    expectation_passed();
  else
    expect_false_failed(act, file, line);
}


x86 assembly (clang, -O0):
<_expect_false>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1148 <_expect_false+0x28>
mov    $0x0,%al
call   1030 <expectation_passed@plt>
jmp    1157 <_expect_false+0x37>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <expect_false_failed@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_expect_false>:
test   %edi,%edi
je     1129 <_expect_false+0x9>
jmp    1040 <expect_false_failed@plt>
xor    %eax,%eax
jmp    1030 <expectation_passed@plt>

LLVM IR (-O0):
define void @_expect_false(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = call i32 (...) @expectation_passed()
br label %16
11: ; preds = %3
%12 = load i32, i32* %4
%13 = load i8*, i8** %5
%14 = load i32, i32* %6
%15 = call i32 @expect_false_failed(i32 %12, i8* %13, i32 %14)
br label %16
16: ; preds = %11, %9
ret void
}

LLVM IR (-O2):
define void @_expect_false(i32 %0, i8* %1, i32 %2) {
%4 = icmp eq i32 %0, 0
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 (...) @expectation_passed()
br label %9
7: ; preds = %3
%8 = tail call i32 @expect_false_failed(i32 %0, i8* %1, i32 %2)
br label %9
9: ; preds = %7, %5
ret void
}
ecmp(a, b, count) register char *a, *b;
register count;
{
  while (count--)
    if (*a++ != *b++)
      return (0);
  return (1);
}


x86 assembly (clang, -O0):
<ecmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x1c(%rbp)
cmp    $0x0,%eax
je     1160 <ecmp+0x60>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     115b <ecmp+0x5b>
movl   $0x0,-0x4(%rbp)
jmp    1167 <ecmp+0x67>
jmp    110f <ecmp+0xf>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ecmp>:
mov    %edx,%r8d
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
cmp    %ecx,%r8d
je     1128 <ecmp+0x28>
movzbl (%rdi,%rcx,1),%edx
lea    0x1(%rcx),%rax
cmp    (%rsi,%rcx,1),%dl
mov    %rax,%rcx
je     1110 <ecmp+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @ecmp(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
br label %8
8: ; preds = %23, %3
%9 = load i32, i32* %7
%10 = add nsw i32 %9, -1
store i32 %10, i32* %7
%11 = icmp ne i32 %9, 0
br i1 %11, label %12, label %24
12: ; preds = %8
%13 = load i8*, i8** %5
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %5
%15 = load i8, i8* %13
%16 = sext i8 %15 to i32
%17 = load i8*, i8** %6
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %6
%19 = load i8, i8* %17
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %16, %20
br i1 %21, label %22, label %23
22: ; preds = %12
store i32 0, i32* %4
br label %25
23: ; preds = %12
br label %8
24: ; preds = %8
store i32 1, i32* %4
br label %25
25: ; preds = %24, %22
%26 = load i32, i32* %4
ret i32 %26
}

LLVM IR (-O2):
define i32 @ecmp(i8* nocapture %0, i8* nocapture %1, i32 %2) {
br label %4
4: ; preds = %9, %3
%5 = phi i8* [ %0, %3 ], [ %11, %9 ]
%6 = phi i8* [ %1, %3 ], [ %13, %9 ]
%7 = phi i32 [ %2, %3 ], [ %10, %9 ]
%8 = icmp eq i32 %7, 0
br i1 %8, label %16, label %9
9: ; preds = %4
%10 = add nsw i32 %7, -1
%11 = getelementptr inbounds i8, i8* %5, i64 1
%12 = load i8, i8* %5
%13 = getelementptr inbounds i8, i8* %6, i64 1
%14 = load i8, i8* %6
%15 = icmp eq i8 %12, %14
br i1 %15, label %4, label %16
16: ; preds = %4, %9
%17 = phi i32 [ 0, %9 ], [ 1, %4 ]
ret i32 %17
}
int ldrb(unsigned char *p) {
  if (p[8] <= 0x7F)
    return 2;
  else
    return 5;
}


x86 assembly (clang, -O0):
<ldrb>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzbl 0x8(%rax),%eax
cmp    $0x7f,%eax
jg     1125 <ldrb+0x25>
movl   $0x2,-0x4(%rbp)
jmp    112c <ldrb+0x2c>
movl   $0x5,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ldrb>:
mov    0x8(%rdi),%al
shr    $0x7,%al
movzbl %al,%eax
lea    (%rax,%rax,2),%eax
add    $0x2,%eax
ret

LLVM IR (-O0):
define i32 @ldrb(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8, i8* %4, i64 8
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = icmp sle i32 %7, 127
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 2, i32* %2
br label %11
10: ; preds = %1
store i32 5, i32* %2
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @ldrb(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 8
%3 = load i8, i8* %2
%4 = icmp sgt i8 %3, -1
%5 = select i1 %4, i32 2, i32 5
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
main() {
  int i = 10, j = 5, k = 0;
  k = (i++) > (++j) ? (i++) : (++j);
  printf("%d  %d  %d \n", i, j, k);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0x5,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
cmp    %ecx,%eax
jle    1163 <main+0x53>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
mov    %eax,-0x14(%rbp)
jmp    116f <main+0x5f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0xc,%esi
mov    $0x6,%edx
mov    $0xb,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"%d %d %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %2
store i32 5, i32* %3
store i32 0, i32* %4
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 1
store i32 %6, i32* %2
%7 = load i32, i32* %3
%8 = add nsw i32 %7, 1
store i32 %8, i32* %3
%9 = icmp sgt i32 %5, %8
br i1 %9, label %10, label %13
10: ; preds = %0
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 1
store i32 %12, i32* %2
br label %16
13: ; preds = %0
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
store i32 %15, i32* %3
br label %16
16: ; preds = %13, %10
%17 = phi i32 [ %11, %10 ], [ %15, %13 ]
store i32 %17, i32* %4
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %18, i32 %19, i32 %20)
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
@.str = [13 x i8] c"%d %d %d \0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 12, i32 6, i32 11)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ test_delete();
int /*<<< orphan*/ test_initializeTT();
int main() {
  printf("///////////////////////\n");
  printf("// THREADED TREE TEST\n");
  printf("///////////////////////\n\n");
  test_initializeTT();
  printf("\n");
  test_delete();
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1040 <printf@plt>
lea    0xec7(%rip),%rdi
call   1040 <printf@plt>
lea    0xed2(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <test_initializeTT@plt>
lea    0xed7(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <test_delete@plt>
lea    0xec4(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeb8(%rip),%rdi
call   1040 <puts@plt>
lea    0xec4(%rip),%rdi
call   1040 <puts@plt>
lea    0xece(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1050 <test_initializeTT@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1060 <test_delete@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"///////////////////////\0A\00"
@.str.1 = [23 x i8] c"// THREADED TREE TEST\0A\00"
@.str.2 = [26 x i8] c"///////////////////////\0A\0A\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 (...) @test_initializeTT()
%6 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 (...) @test_delete()
%8 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [24 x i8] c"///////////////////////\00"
@str.4 = [22 x i8] c"// THREADED TREE TEST\00"
@str.5 = [25 x i8] c"///////////////////////\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.4, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.5, i64 0, i64 0))
%4 = tail call i32 (...) @test_initializeTT()
%5 = tail call i32 @putchar(i32 10)
%6 = tail call i32 (...) @test_delete()
%7 = tail call i32 @putchar(i32 10)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ srand(unsigned int);
void srandom(unsigned seed) { srand(seed); }


x86 assembly (clang, -O0):
<srandom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <srand@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<srandom>:
jmp    1030 <srand@plt>

LLVM IR (-O0):
define void @srandom(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @srand(i32 %3)
ret void
}

LLVM IR (-O2):
define void @srandom(i32 %0) {
%2 = tail call i32 @srand(i32 %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
char *ctime(int /*<<< orphan*/ *);
scalar_t__ strlen(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
char *Getdate(void) {
  int len;
  time_t t;
  char *p;
  t = time((time_t *)0);
  p = ctime(&t);
  len = (int)strlen(p);
  *(p + len - 1) = '\0';
  return p;
}


x86 assembly (clang, -O0):
<Getdate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
call   1030 <ctime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
movb   $0x0,-0x1(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Getdate>:
push   %rbx
sub    $0x10,%rsp
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <ctime@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <strlen@plt>
cltq
movb   $0x0,-0x1(%rbx,%rax,1)
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i8* @Getdate() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = call i32 @time(i32* null)
store i32 %4, i32* %2
%5 = call i8* @ctime(i32* %2)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = call i64 @strlen(i8* %6)
%8 = trunc i64 %7 to i32
store i32 %8, i32* %1
%9 = load i8*, i8** %3
%10 = load i32, i32* %1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
%13 = getelementptr inbounds i8, i8* %12, i64 -1
store i8 0, i8* %13
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
define i8* @Getdate() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @time(i32* null)
store i32 %3, i32* %1
%4 = call i8* @ctime(i32* %1)
%5 = call i64 @strlen(i8* dereferenceable(1) %4)
%6 = shl i64 %5, 32
%7 = ashr exact i64 %6, 32
%8 = getelementptr inbounds i8, i8* %4, i64 %7
%9 = getelementptr inbounds i8, i8* %8, i64 -1
store i8 0, i8* %9
ret i8* %4
}
int find_prime(int n, int div) {
  if (div == n)
    return (div);
  if (n % div == 0)
    return (0);
  return (find_prime(n, div + 2));
}


x86 assembly (clang, -O0):
<find_prime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1135 <find_prime+0x25>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1162 <find_prime+0x52>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1151 <find_prime+0x41>
movl   $0x0,-0x4(%rbp)
jmp    1162 <find_prime+0x52>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
add    $0x2,%esi
call   1030 <find_prime@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_prime>:
cmp    %edi,%esi
je     1122 <find_prime+0x22>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
je     1125 <find_prime+0x25>
add    $0x2,%esi
cmp    %esi,%edi
jne    1110 <find_prime+0x10>
mov    %edi,%esi
mov    %esi,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @find_prime(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = load i32, i32* %4
%8 = icmp eq i32 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load i32, i32* %5
store i32 %10, i32* %3
br label %22
11: ; preds = %2
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = srem i32 %12, %13
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %11
store i32 0, i32* %3
br label %22
17: ; preds = %11
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 2
%21 = call i32 @find_prime(i32 %18, i32 %20)
store i32 %21, i32* %3
br label %22
22: ; preds = %17, %16, %9
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
define i32 @find_prime(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, %0
br i1 %3, label %11, label %4
4: ; preds = %2, %8
%5 = phi i32 [ %9, %8 ], [ %1, %2 ]
%6 = srem i32 %0, %5
%7 = icmp eq i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %4
%9 = add nsw i32 %5, 2
%10 = icmp eq i32 %9, %0
br i1 %10, label %11, label %4
11: ; preds = %8, %4, %2
%12 = phi i32 [ %1, %2 ], [ 0, %4 ], [ %0, %8 ]
ret i32 %12
}
/* Variables and functions */
scalar_t__ Pop();
int /*<<< orphan*/ Push(scalar_t__);
void DoAdd() { Push(Pop() + Pop()); }


x86 assembly (clang, -O0):
<DoAdd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <Pop@plt>
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <Pop@plt>
mov    -0x8(%rbp),%rdi
add    %rax,%rdi
call   1040 <Push@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DoAdd>:
push   %rbx
xor    %eax,%eax
call   1030 <Pop@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1030 <Pop@plt>
add    %rax,%rbx
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <Push@plt>

LLVM IR (-O0):
define void @DoAdd() {
%1 = call i64 (...) @Pop()
%2 = call i64 (...) @Pop()
%3 = add nsw i64 %1, %2
%4 = call i32 @Push(i64 %3)
ret void
}

LLVM IR (-O2):
define void @DoAdd() {
%1 = tail call i64 (...) @Pop()
%2 = tail call i64 (...) @Pop()
%3 = add nsw i64 %2, %1
%4 = tail call i32 @Push(i64 %3)
ret void
}
const char *get_description(void) {
  return "The vloopback playback plugin makes LiVES appear as a video device "
         "in /dev.\n";
}


x86 assembly (clang, -O0):
<get_description>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_description>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [77 x i8] c"The vloopback playback plugin makes LiVES appear as a video device in /dev.\0A\00"
define i8* @get_description() {
ret i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [77 x i8] c"The vloopback playback plugin makes LiVES appear as a video device in /dev.\0A\00"
define i8* @get_description() {
ret i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int recv(int, char *, int, int /*<<< orphan*/);
int recv_socket(int sockfd, char *buffer, int to_read) {
  int read = 0;
  if ((sockfd != -1) && buffer && (to_read > 0)) {
    read = recv(sockfd, buffer, to_read, 0);
  }
  return read;
}


x86 assembly (clang, -O0):
<recv_socket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
je     115c <recv_socket+0x4c>
cmpq   $0x0,-0x10(%rbp)
je     115c <recv_socket+0x4c>
cmpl   $0x0,-0x14(%rbp)
jle    115c <recv_socket+0x4c>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<recv_socket>:
cmp    $0xffffffff,%edi
je     1125 <recv_socket+0x15>
test   %rsi,%rsi
je     1125 <recv_socket+0x15>
test   %edx,%edx
jle    1125 <recv_socket+0x15>
xor    %ecx,%ecx
jmp    1030 <recv@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @recv_socket(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
store i32 0, i32* %7
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, -1
br i1 %9, label %10, label %21
10: ; preds = %3
%11 = load i8*, i8** %5
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %21
13: ; preds = %10
%14 = load i32, i32* %6
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %13
%17 = load i32, i32* %4
%18 = load i8*, i8** %5
%19 = load i32, i32* %6
%20 = call i32 @recv(i32 %17, i8* %18, i32 %19, i32 0)
store i32 %20, i32* %7
br label %21
21: ; preds = %16, %13, %10, %3
%22 = load i32, i32* %7
ret i32 %22
}

LLVM IR (-O2):
define i32 @recv_socket(i32 %0, i8* %1, i32 %2) {
%4 = icmp ne i32 %0, -1
%5 = icmp ne i8* %1, null
%6 = and i1 %4, %5
%7 = icmp sgt i32 %2, 0
%8 = and i1 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = tail call i32 @recv(i32 %0, i8* %1, i32 %2, i32 0)
br label %11
11: ; preds = %9, %3
%12 = phi i32 [ %10, %9 ], [ 0, %3 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ uart_send_byte(int /*<<< orphan*/);
void uart_send_str(char *str) {
  if (NULL == str)
    return;
  while (*str != '\0') {
    uart_send_byte(*str++);
  }
}


x86 assembly (clang, -O0):
<uart_send_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%rax
jne    112d <uart_send_str+0x1d>
jmp    115e <uart_send_str+0x4e>
jmp    1132 <uart_send_str+0x22>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     115e <uart_send_str+0x4e>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <uart_send_byte@plt>
jmp    1132 <uart_send_str+0x22>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_send_str>:
push   %rbx
test   %rdi,%rdi
je     1143 <uart_send_str+0x33>
mov    %rdi,%rbx
mov    (%rdi),%al
test   %al,%al
je     1143 <uart_send_str+0x33>
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl %al,%edi
call   1030 <uart_send_byte@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <uart_send_str+0x20>
pop    %rbx
ret

LLVM IR (-O0):
define void @uart_send_str(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp eq i8* null, %3
br i1 %4, label %5, label %6
5: ; preds = %1
br label %18
6: ; preds = %1
br label %7
7: ; preds = %12, %6
%8 = load i8*, i8** %2
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %7
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %2
%15 = load i8, i8* %13
%16 = sext i8 %15 to i32
%17 = call i32 @uart_send_byte(i32 %16)
br label %7
18: ; preds = %5, %7
ret void
}

LLVM IR (-O2):
define void @uart_send_str(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %14, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %14, label %6
6: ; preds = %3, %6
%7 = phi i8 [ %12, %6 ], [ %4, %3 ]
%8 = phi i8* [ %10, %6 ], [ %0, %3 ]
%9 = sext i8 %7 to i32
%10 = getelementptr inbounds i8, i8* %8, i64 1
%11 = tail call i32 @uart_send_byte(i32 %9)
%12 = load i8, i8* %10
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %6
14: ; preds = %6, %3, %1
ret void
}
int abs_val(int i) { return i < 0 ? -i : i; }


x86 assembly (clang, -O0):
<abs_val>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    111e <abs_val+0x1e>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1124 <abs_val+0x24>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<abs_val>:
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
ret

LLVM IR (-O0):
define i32 @abs_val(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = sub nsw i32 0, %6
br label %10
8: ; preds = %1
%9 = load i32, i32* %2
br label %10
10: ; preds = %8, %5
%11 = phi i32 [ %7, %5 ], [ %9, %8 ]
ret i32 %11
}

LLVM IR (-O2):
define i32 @abs_val(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
int foo(int a) {
  if (a == 0) {
    return 1;
  } else if (a == 1) {
    return 9;
  } else {
    return 3;
  }
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    111d <foo+0x1d>
movl   $0x1,-0x4(%rbp)
jmp    113a <foo+0x3a>
cmpl   $0x1,-0x8(%rbp)
jne    1133 <foo+0x33>
movl   $0x9,-0x4(%rbp)
jmp    113a <foo+0x3a>
movl   $0x3,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
cmp    $0x1,%edi
mov    $0x9,%eax
mov    $0x3,%ecx
cmove  %eax,%ecx
test   %edi,%edi
mov    $0x1,%eax
cmovne %ecx,%eax
ret

LLVM IR (-O0):
define i32 @foo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 1, i32* %2
br label %12
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 9, i32* %2
br label %12
11: ; preds = %7
store i32 3, i32* %2
br label %12
12: ; preds = %11, %10, %6
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = icmp eq i32 %0, 1
%3 = select i1 %2, i32 9, i32 3
%4 = icmp eq i32 %0, 0
%5 = select i1 %4, i32 1, i32 %3
ret i32 %5
}
/* Type definitions */
struct Stack {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ Stack_clear(struct Stack *const);
int /*<<< orphan*/ free(struct Stack *const);
void Stack_delete(struct Stack *const inStack) {
  Stack_clear(inStack);
  free(inStack);
}


x86 assembly (clang, -O0):
<Stack_delete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <Stack_clear@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Stack_delete>:
push   %rbx
mov    %rdi,%rbx
call   1040 <Stack_clear@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.Stack = type { i32 }
define void @Stack_delete(%struct.Stack* %0) {
%2 = alloca %struct.Stack*
store %struct.Stack* %0, %struct.Stack** %2
%3 = load %struct.Stack*, %struct.Stack** %2
%4 = call i32 @Stack_clear(%struct.Stack* %3)
%5 = load %struct.Stack*, %struct.Stack** %2
%6 = call i32 @free(%struct.Stack* %5)
ret void
}

LLVM IR (-O2):
%struct.Stack = type { i32 }
define void @Stack_delete(%struct.Stack* %0) {
%2 = tail call i32 @Stack_clear(%struct.Stack* %0)
%3 = tail call i32 @free(%struct.Stack* %0)
ret void
}
int count_odd(int a, int b) {
  int sum = a + b - '0' - '0';
  sum %= 13;
  if (sum < 10)
    sum = sum + '0';
  else if (sum == 10)
    sum = 'J';
  else if (sum == 11)
    sum = 'Q';
  else if (sum == 12)
    sum = 'K';
  return sum;
}


x86 assembly (clang, -O0):
<count_odd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
sub    $0x30,%eax
sub    $0x30,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xd,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    113f <count_odd+0x3f>
mov    -0xc(%rbp),%eax
add    $0x30,%eax
mov    %eax,-0xc(%rbp)
jmp    118b <count_odd+0x8b>
cmpl   $0xa,-0xc(%rbp)
jne    1155 <count_odd+0x55>
movl   $0x4a,-0xc(%rbp)
jmp    1186 <count_odd+0x86>
cmpl   $0xb,-0xc(%rbp)
jne    116b <count_odd+0x6b>
movl   $0x51,-0xc(%rbp)
jmp    1181 <count_odd+0x81>
cmpl   $0xc,-0xc(%rbp)
jne    117c <count_odd+0x7c>
movl   $0x4b,-0xc(%rbp)
jmp    1181 <count_odd+0x81>
jmp    1186 <count_odd+0x86>
jmp    118b <count_odd+0x8b>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_odd>:
lea    (%rdi,%rsi,1),%eax
add    $0xffffffa0,%eax
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,2),%edx
lea    (%rcx,%rdx,4),%ecx
sub    %ecx,%eax
cmp    $0x9,%eax
jg     112d <count_odd+0x2d>
add    $0x30,%eax
ret
cmp    $0xb,%eax
mov    $0x51,%ecx
mov    $0x4b,%edx
cmove  %ecx,%edx
cmp    $0xa,%eax
mov    $0x4a,%eax
cmovne %edx,%eax
ret

LLVM IR (-O0):
define i32 @count_odd(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = add nsw i32 %6, %7
%9 = sub nsw i32 %8, 48
%10 = sub nsw i32 %9, 48
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = srem i32 %11, 13
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = icmp slt i32 %13, 10
br i1 %14, label %15, label %18
15: ; preds = %2
%16 = load i32, i32* %5
%17 = add nsw i32 %16, 48
store i32 %17, i32* %5
br label %33
18: ; preds = %2
%19 = load i32, i32* %5
%20 = icmp eq i32 %19, 10
br i1 %20, label %21, label %22
21: ; preds = %18
store i32 74, i32* %5
br label %32
22: ; preds = %18
%23 = load i32, i32* %5
%24 = icmp eq i32 %23, 11
br i1 %24, label %25, label %26
25: ; preds = %22
store i32 81, i32* %5
br label %31
26: ; preds = %22
%27 = load i32, i32* %5
%28 = icmp eq i32 %27, 12
br i1 %28, label %29, label %30
29: ; preds = %26
store i32 75, i32* %5
br label %30
30: ; preds = %29, %26
br label %31
31: ; preds = %30, %25
br label %32
32: ; preds = %31, %21
br label %33
33: ; preds = %32, %15
%34 = load i32, i32* %5
ret i32 %34
}

LLVM IR (-O2):
define i32 @count_odd(i32 %0, i32 %1) {
%3 = add i32 %0, -96
%4 = add i32 %3, %1
%5 = srem i32 %4, 13
%6 = icmp slt i32 %5, 10
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = add nsw i32 %5, 48
br label %14
9: ; preds = %2
%10 = icmp eq i32 %5, 11
%11 = select i1 %10, i32 81, i32 75
%12 = icmp eq i32 %5, 10
%13 = select i1 %12, i32 74, i32 %11
br label %14
14: ; preds = %9, %7
%15 = phi i32 [ %8, %7 ], [ %13, %9 ]
ret i32 %15
}
/* Variables and functions */
int pretty_print_colour_state();
bool pretty_print_color_get_state(void) { return pretty_print_colour_state(); }


x86 assembly (clang, -O0):
<pretty_print_color_get_state>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <pretty_print_colour_state@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<pretty_print_color_get_state>:
xor    %eax,%eax
jmp    1030 <pretty_print_colour_state@plt>

LLVM IR (-O0):
define i32 @pretty_print_color_get_state() {
%1 = call i32 (...) @pretty_print_colour_state()
ret i32 %1
}

LLVM IR (-O2):
define i32 @pretty_print_color_get_state() {
%1 = tail call i32 (...) @pretty_print_colour_state()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ ExtAccumulator(int);
void SUB(void) { ExtAccumulator(2); }


x86 assembly (clang, -O0):
<SUB>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
call   1030 <ExtAccumulator@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<SUB>:
mov    $0x2,%edi
jmp    1030 <ExtAccumulator@plt>

LLVM IR (-O0):
define void @SUB() {
%1 = call i32 @ExtAccumulator(i32 2)
ret void
}

LLVM IR (-O2):
define void @SUB() {
%1 = tail call i32 @ExtAccumulator(i32 2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ lgen(char *, char *, int);
void cgdecsw(int a) { lgen("%s\t%c%d", "decl", a); }


x86 assembly (clang, -O0):
<cgdecsw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
lea    0xedb(%rip),%rdi
lea    0xedc(%rip),%rsi
call   1030 <lgen@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cgdecsw>:
mov    %edi,%edx
lea    0xee7(%rip),%rdi
lea    0xee8(%rip),%rsi
jmp    1030 <lgen@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"%s\09%c%d\00"
@.str.1 = [5 x i8] c"decl\00"
define void @cgdecsw(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @lgen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"%s\09%c%d\00"
@.str.1 = [5 x i8] c"decl\00"
define void @cgdecsw(i32 %0) {
%2 = tail call i32 @lgen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %0)
ret void
}
int main() { return 1 >> 2; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}