xunge/DecIR huggingface dataset:
/* Type definitions */
struct ht16k33_7Segment {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *ht16k337Seg_intTo4Chars(int);
int ht16k337Seg_printStr(struct ht16k33_7Segment *, char *);
int ht16k337Seg_printInteger(struct ht16k33_7Segment *device, int value) {
  char *str = ht16k337Seg_intTo4Chars(value);
  int ret = ht16k337Seg_printStr(device, str);
  free(str);
  return ret;
}


x86 assembly (clang, -O0):
<ht16k337Seg_printInteger>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <ht16k337Seg_intTo4Chars@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <ht16k337Seg_printStr@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ht16k337Seg_printInteger>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
mov    %esi,%edi
call   1050 <ht16k337Seg_intTo4Chars@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1040 <ht16k337Seg_printStr@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.ht16k33_7Segment = type { i32 }
define i32 @ht16k337Seg_printInteger(%struct.ht16k33_7Segment* %0, i32 %1) {
%3 = alloca %struct.ht16k33_7Segment*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store %struct.ht16k33_7Segment* %0, %struct.ht16k33_7Segment** %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = call i8* @ht16k337Seg_intTo4Chars(i32 %7)
store i8* %8, i8** %5
%9 = load %struct.ht16k33_7Segment*, %struct.ht16k33_7Segment** %3
%10 = load i8*, i8** %5
%11 = call i32 @ht16k337Seg_printStr(%struct.ht16k33_7Segment* %9, i8* %10)
store i32 %11, i32* %6
%12 = load i8*, i8** %5
%13 = call i32 @free(i8* %12)
%14 = load i32, i32* %6
ret i32 %14
}

LLVM IR (-O2):
%struct.ht16k33_7Segment = type { i32 }
define i32 @ht16k337Seg_printInteger(%struct.ht16k33_7Segment* %0, i32 %1) {
%3 = tail call i8* @ht16k337Seg_intTo4Chars(i32 %1)
%4 = tail call i32 @ht16k337Seg_printStr(%struct.ht16k33_7Segment* %0, i8* %3)
%5 = tail call i32 @free(i8* %3)
ret i32 %4
}
/* Type definitions */
struct sStreamCodec {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ StreamCodec_StreamCodec(struct sStreamCodec *,
                                           unsigned char *, unsigned int);
void StreamEncoder_StreamEncoder(struct sStreamCodec *p, unsigned char *buf,
                                 unsigned int bufsize) {
  StreamCodec_StreamCodec(p, buf, bufsize);
}


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

x86 assembly (clang, -O2):
<StreamEncoder_StreamEncoder>:
jmp    1030 <StreamCodec_StreamCodec@plt>

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

LLVM IR (-O2):
%struct.sStreamCodec = type { i32 }
define void @StreamEncoder_StreamEncoder(%struct.sStreamCodec* %0, i8* %1, i32 %2) {
%4 = tail call i32 @StreamCodec_StreamCodec(%struct.sStreamCodec* %0, i8* %1, i32 %2)
ret void
}
/* Type definitions */
typedef int uint64_t;
struct timeval {
  int tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
uint64_t millis(void) {
  struct timeval current;
  uint64_t elapsed;
  gettimeofday(&current, NULL);
  elapsed = (uint64_t)current.tv_sec * (uint64_t)1000 +
            (uint64_t)(current.tv_usec / 1000);
  return elapsed;
}


x86 assembly (clang, -O0):
<millis>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
mov    -0x8(%rbp),%rax
imul   $0x3e8,%eax,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<millis>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
imul   $0x3e8,0x10(%rsp),%ecx
movslq 0x8(%rsp),%rax
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rax
add    %edx,%eax
add    %ecx,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
define i32 @millis() {
%1 = alloca %struct.timeval
%2 = alloca i32
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
%7 = mul nsw i32 %6, 1000
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%9 = load i32, i32* %8
%10 = sdiv i32 %9, 1000
%11 = add nsw i32 %7, %10
store i32 %11, i32* %2
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
define i32 @millis() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
%7 = mul nsw i32 %6, 1000
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%9 = load i32, i32* %8
%10 = sdiv i32 %9, 1000
%11 = add nsw i32 %7, %10
ret i32 %11
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
uint64_t read_u16(const void *const ptr) { return *(uint16_t *)ptr; }


x86 assembly (clang, -O0):
<read_u16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_u16>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @read_u16(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @read_u16(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
ret i32 %3
}
/* Variables and functions */
int len(char *, char *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  char *s1 = "hello";
  char *s2 = "strng";
  printf("%d", len(s1, s2));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xecc(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <len@plt>
mov    %eax,%esi
lea    0xeb8(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xed7(%rip),%rsi
call   1030 <len@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"hello\00"
@.str.1 = [6 x i8] c"strng\00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i8*
%2 = alloca i8*
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %2
%3 = load i8*, i8** %1
%4 = load i8*, i8** %2
%5 = call i32 @len(i8* %3, i8* %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"hello\00"
@.str.1 = [6 x i8] c"strng\00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i32 @len(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ test1();
int /*<<< orphan*/ test2();
int main(int argc, char **argv) {
  test1();
  test2();
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <test1@plt>
mov    $0x0,%al
call   1040 <test2@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <test1@plt>
xor    %eax,%eax
call   1040 <test2@plt>
xor    %eax,%eax
pop    %rcx
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 = call i32 (...) @test1()
%7 = call i32 (...) @test2()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @test1()
%4 = tail call i32 (...) @test2()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ test_groovy_comment_entities();
int /*<<< orphan*/ test_groovy_comments();
void all_groovy_tests() {
  test_groovy_comments();
  test_groovy_comment_entities();
}


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

x86 assembly (clang, -O2):
<all_groovy_tests>:
push   %rax
xor    %eax,%eax
call   1040 <test_groovy_comments@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <test_groovy_comment_entities@plt>

LLVM IR (-O0):
define void @all_groovy_tests() {
%1 = call i32 (...) @test_groovy_comments()
%2 = call i32 (...) @test_groovy_comment_entities()
ret void
}

LLVM IR (-O2):
define void @all_groovy_tests() {
%1 = tail call i32 (...) @test_groovy_comments()
%2 = tail call i32 (...) @test_groovy_comment_entities()
ret void
}
/* Variables and functions */
char toupper(char);
void stoupper(char **s) {
  int i = 0;
  while ((*s)[i] != '\0') {
    (*s)[i] = toupper((*s)[i]);
    i++;
  }
}


x86 assembly (clang, -O0):
<stoupper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     116d <stoupper+0x5d>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <toupper@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <stoupper+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stoupper>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%rax
mov    (%rax),%al
test   %al,%al
je     114e <stoupper+0x3e>
mov    %rdi,%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl %al,%edi
call   1030 <toupper@plt>
mov    (%r14),%rcx
mov    %al,(%rcx,%rbx,1)
mov    (%r14),%rax
movzbl 0x1(%rax,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <stoupper+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @stoupper(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = load i8, i8* %2
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %1, %5
%6 = phi i64 [ %11, %5 ], [ 0, %1 ]
%7 = phi i8 [ %14, %5 ], [ %3, %1 ]
%8 = tail call signext i8 @toupper(i8 signext %7)
%9 = load i8*, i8** %0
%10 = getelementptr inbounds i8, i8* %9, i64 %6
store i8 %8, i8* %10
%11 = add nuw i64 %6, 1
%12 = load i8*, i8** %0
%13 = getelementptr inbounds i8, i8* %12, i64 %11
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %5, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void print_word(char *word) { printf("%s", word); }


x86 assembly (clang, -O0):
<print_word>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_word>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @print_word(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ultoa(char *, unsigned long, int);
void ltoa(char *buf, long d, int base) {
  unsigned long n = d;
  if (base == 10 && d < 0) {
    *buf++ = '-';
    n = (unsigned long)(-d);
  }
  ultoa(buf, n, base);
}


x86 assembly (clang, -O0):
<ltoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpl   $0xa,-0x14(%rbp)
jne    115c <ltoa+0x4c>
cmpq   $0x0,-0x10(%rbp)
jge    115c <ltoa+0x4c>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movb   $0x2d,(%rax)
xor    %eax,%eax
sub    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <ultoa@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ltoa>:
test   %rsi,%rsi
jns    1124 <ltoa+0x14>
cmp    $0xa,%edx
jne    1124 <ltoa+0x14>
movb   $0x2d,(%rdi)
add    $0x1,%rdi
neg    %rsi
jmp    1030 <ultoa@plt>

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

LLVM IR (-O2):
define void @ltoa(i8* %0, i64 %1, i32 %2) {
%4 = icmp eq i32 %2, 10
%5 = icmp slt i64 %1, 0
%6 = and i1 %5, %4
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = getelementptr inbounds i8, i8* %0, i64 1
store i8 45, i8* %0
%9 = sub nsw i64 0, %1
br label %10
10: ; preds = %7, %3
%11 = phi i8* [ %8, %7 ], [ %0, %3 ]
%12 = phi i64 [ %9, %7 ], [ %1, %3 ]
%13 = tail call i32 @ultoa(i8* %11, i64 %12, i32 %2)
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int send_event;
};
typedef TYPE_1__ XKeyEvent;

/* Variables and functions */
void set_XKeyEvent_send_event(void *_p, int _v) {
  ((XKeyEvent *)_p)->send_event = (int)_v;
}


x86 assembly (clang, -O0):
<set_XKeyEvent_send_event>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_XKeyEvent_send_event>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32 }
define void @set_XKeyEvent_send_event(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i32 %5, i32* %8
ret void
}

LLVM IR (-O2):
define void @set_XKeyEvent_send_event(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
void bacct_add_tsk(struct taskstats *stats, struct task_struct *tsk) {}


x86 assembly (clang, -O0):
<bacct_add_tsk>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<bacct_add_tsk>:
ret

LLVM IR (-O0):
%struct.taskstats = type opaque
%struct.task_struct = type opaque
define void @bacct_add_tsk(%struct.taskstats* %0, %struct.task_struct* %1) {
%3 = alloca %struct.taskstats*
%4 = alloca %struct.task_struct*
store %struct.taskstats* %0, %struct.taskstats** %3
store %struct.task_struct* %1, %struct.task_struct** %4
ret void
}

LLVM IR (-O2):
%struct.taskstats = type opaque
%struct.task_struct = type opaque
define void @bacct_add_tsk(%struct.taskstats* nocapture %0, %struct.task_struct* nocapture %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ ttl;

/* Variables and functions */
int /*<<< orphan*/ IPPROTO_IP;
int /*<<< orphan*/ IP_MULTICAST_TTL;
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *, int);
int socket_set_ttl(int sock, int ttl) {
  if (ttl)
    return setsockopt(sock, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl));
  return 0;
}


x86 assembly (clang, -O0):
<socket_set_ttl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1154 <socket_set_ttl+0x44>
mov    -0x8(%rbp),%edi
mov    0x2eb6(%rip),%rax
mov    (%rax),%esi
mov    0x2e9d(%rip),%rax
mov    (%rax),%edx
lea    -0xc(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    %eax,-0x4(%rbp)
jmp    115b <socket_set_ttl+0x4b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<socket_set_ttl>:
push   %rax
mov    %esi,0x4(%rsp)
test   %esi,%esi
je     113d <socket_set_ttl+0x2d>
mov    0x2ec8(%rip),%rax
mov    (%rax),%esi
mov    0x2eaf(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@IPPROTO_IP = global i32 0
@IP_MULTICAST_TTL = global i32 0
define i32 @socket_set_ttl(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 = icmp ne i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i32, i32* %4
%10 = load i32, i32* @IPPROTO_IP
%11 = load i32, i32* @IP_MULTICAST_TTL
%12 = call i32 @setsockopt(i32 %9, i32 %10, i32 %11, i32* %5, i32 4)
store i32 %12, i32* %3
br label %14
13: ; preds = %2
store i32 0, i32* %3
br label %14
14: ; preds = %13, %8
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
@IPPROTO_IP = global i32 0
@IP_MULTICAST_TTL = global i32 0
define i32 @socket_set_ttl(i32 %0, i32 %1) {
%3 = alloca i32
store i32 %1, i32* %3
%4 = icmp eq i32 %1, 0
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = load i32, i32* @IPPROTO_IP
%7 = load i32, i32* @IP_MULTICAST_TTL
%8 = call i32 @setsockopt(i32 %0, i32 %6, i32 %7, i32* %3, i32 4)
br label %9
9: ; preds = %2, %5
%10 = phi i32 [ %8, %5 ], [ 0, %2 ]
ret i32 %10
}
unsigned int _packl4(unsigned int src1, unsigned int src2) {
  unsigned v3 = (src1 >> 16) & 0xff;
  unsigned v2 = (src1)&0xff;
  unsigned v1 = (src2 >> 16) & 0xff;
  unsigned v0 = (src2)&0xff;
  unsigned v = (v3 << 24) | (v2 << 16) | (v1 << 8) | v0;
  return v;
}


x86 assembly (clang, -O0):
<_packl4>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x10,%eax
and    $0xff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x10,%eax
and    $0xff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x18,%eax
mov    -0x10(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x14(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_packl4>:
movzbl %sil,%ecx
movzbl %dil,%eax
shl    $0x8,%edi
and    $0xff000000,%edi
shl    $0x10,%eax
or     %edi,%eax
or     %ecx,%eax
shr    $0x8,%esi
and    $0xff00,%esi
or     %esi,%eax
ret

LLVM IR (-O0):
define i32 @_packl4(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%10 = load i32, i32* %3
%11 = lshr i32 %10, 16
%12 = and i32 %11, 255
store i32 %12, i32* %5
%13 = load i32, i32* %3
%14 = and i32 %13, 255
store i32 %14, i32* %6
%15 = load i32, i32* %4
%16 = lshr i32 %15, 16
%17 = and i32 %16, 255
store i32 %17, i32* %7
%18 = load i32, i32* %4
%19 = and i32 %18, 255
store i32 %19, i32* %8
%20 = load i32, i32* %5
%21 = shl i32 %20, 24
%22 = load i32, i32* %6
%23 = shl i32 %22, 16
%24 = or i32 %21, %23
%25 = load i32, i32* %7
%26 = shl i32 %25, 8
%27 = or i32 %24, %26
%28 = load i32, i32* %8
%29 = or i32 %27, %28
store i32 %29, i32* %9
%30 = load i32, i32* %9
ret i32 %30
}

LLVM IR (-O2):
define i32 @_packl4(i32 %0, i32 %1) {
%3 = and i32 %1, 255
%4 = shl i32 %0, 8
%5 = and i32 %4, -16777216
%6 = shl i32 %0, 16
%7 = and i32 %6, 16711680
%8 = or i32 %5, %7
%9 = lshr i32 %1, 8
%10 = and i32 %9, 65280
%11 = or i32 %8, %3
%12 = or i32 %11, %10
ret i32 %12
}
_Bool f(float f) { return f; }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
setne  %al
setp   %cl
or     %cl,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
xorps  %xmm1,%xmm1
cmpneqss %xmm0,%xmm1
movd   %xmm1,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define zeroext i1 @f(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fcmp une float %3, 0.000000e+00
ret i1 %4
}

LLVM IR (-O2):
define zeroext i1 @f(float %0) {
%2 = fcmp une float %0, 0.000000e+00
ret i1 %2
}
/* Type definitions */
typedef int uint64_t;
typedef int int64_t;

/* Variables and functions */
int getpid();
int rdtsc();
float clock_pid() {
  uint64_t start = rdtsc();
  int hi = getpid();
  uint64_t stop = rdtsc();
  unsigned int lo = start & (((uint64_t)2 << 32) - 1);
  unsigned int lo2 = stop & (((int64_t)2 << 32) - 1);
  int cycles = lo2 - lo;
  float t = ((float)(cycles));
  float factor = 3591338000.0 * .000001;
  t = t / factor;
  return t;
}


x86 assembly (clang, -O0):
<clock_pid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1040 <rdtsc@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <rdtsc@plt>
mov    %eax,-0xc(%rbp)
and    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
and    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
cvtsi2ssl -0x18(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  0xe93(%rip),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x1c(%rbp),%xmm0
divss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clock_pid>:
push   %rax
xor    %eax,%eax
call   1040 <rdtsc@plt>
xor    %eax,%eax
call   1030 <getpid@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <rdtsc@plt>

LLVM IR (-O0):
define float @clock_pid() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca float
%8 = alloca float
%9 = call i32 (...) @rdtsc()
store i32 %9, i32* %1
%10 = call i32 (...) @getpid()
store i32 %10, i32* %2
%11 = call i32 (...) @rdtsc()
store i32 %11, i32* %3
%12 = load i32, i32* %1
%13 = and i32 %12, poison
store i32 %13, i32* %4
%14 = load i32, i32* %3
%15 = and i32 %14, poison
store i32 %15, i32* %5
%16 = load i32, i32* %5
%17 = load i32, i32* %4
%18 = sub i32 %16, %17
store i32 %18, i32* %6
%19 = load i32, i32* %6
%20 = sitofp i32 %19 to float
store float %20, float* %7
store float 0x40AC0EAD00000000, float* %8
%21 = load float, float* %7
%22 = load float, float* %8
%23 = fdiv float %21, %22
store float %23, float* %7
%24 = load float, float* %7
ret float %24
}

LLVM IR (-O2):
define float @clock_pid() {
%1 = tail call i32 (...) @rdtsc()
%2 = tail call i32 (...) @getpid()
%3 = tail call i32 (...) @rdtsc()
ret float poison
}
int main() { struct station; }


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

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

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

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


x86 assembly (clang, -O0):
<EVP_MD_pkey_type>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EVP_MD_pkey_type>:
ret

LLVM IR (-O0):
define void @EVP_MD_pkey_type() {
ret void
}

LLVM IR (-O2):
define void @EVP_MD_pkey_type() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ HwAQ32Handle();
int /*<<< orphan*/ UAVObjUpdated(int /*<<< orphan*/);
void HwAQ32Updated() { UAVObjUpdated(HwAQ32Handle()); }


x86 assembly (clang, -O0):
<HwAQ32Updated>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <HwAQ32Handle@plt>
mov    %eax,%edi
call   1040 <UAVObjUpdated@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<HwAQ32Updated>:
push   %rax
xor    %eax,%eax
call   1030 <HwAQ32Handle@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <UAVObjUpdated@plt>

LLVM IR (-O0):
define void @HwAQ32Updated() {
%1 = call i32 (...) @HwAQ32Handle()
%2 = call i32 @UAVObjUpdated(i32 %1)
ret void
}

LLVM IR (-O2):
define void @HwAQ32Updated() {
%1 = tail call i32 (...) @HwAQ32Handle()
%2 = tail call i32 @UAVObjUpdated(i32 %1)
ret void
}
int eprimo(int primos[], int achados, int candidato) {
  int i;
  for (i = 0; i < achados; i++) {
    if (candidato % primos[i] == 0)
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<eprimo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1158 <eprimo+0x58>
mov    -0x18(%rbp),%eax
mov    -0x10(%rbp),%rcx
movslq -0x1c(%rbp),%rsi
cltd
idivl  (%rcx,%rsi,4)
cmp    $0x0,%edx
jne    1145 <eprimo+0x45>
movl   $0x0,-0x4(%rbp)
jmp    115f <eprimo+0x5f>
jmp    114a <eprimo+0x4a>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1115 <eprimo+0x15>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<eprimo>:
mov    $0x1,%r8d
test   %esi,%esi
jle    1134 <eprimo+0x34>
mov    %edx,%r9d
mov    %esi,%esi
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r9d,%eax
cltd
idivl  (%rdi,%rcx,4)
test   %edx,%edx
je     1138 <eprimo+0x38>
add    $0x1,%rcx
cmp    %rcx,%rsi
jne    1120 <eprimo+0x20>
mov    %r8d,%eax
ret
xor    %r8d,%r8d
mov    %r8d,%eax
ret

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

LLVM IR (-O2):
define i32 @eprimo(i32* nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %16
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %9
7: ; preds = %9
%8 = icmp eq i64 %15, %6
br i1 %8, label %16, label %9
9: ; preds = %5, %7
%10 = phi i64 [ 0, %5 ], [ %15, %7 ]
%11 = getelementptr inbounds i32, i32* %0, i64 %10
%12 = load i32, i32* %11
%13 = srem i32 %2, %12
%14 = icmp eq i32 %13, 0
%15 = add nuw nsw i64 %10, 1
br i1 %14, label %16, label %7
16: ; preds = %9, %7, %3
%17 = phi i32 [ 1, %3 ], [ 1, %7 ], [ 0, %9 ]
ret i32 %17
}
int char_needs_escaping(int c) {
  if (c < 0x20 || c == 0x22 || c == 0x5c) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<char_needs_escaping>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
jl     1125 <char_needs_escaping+0x25>
cmpl   $0x22,-0x8(%rbp)
je     1125 <char_needs_escaping+0x25>
cmpl   $0x5c,-0x8(%rbp)
jne    1131 <char_needs_escaping+0x31>
movl   $0x1,-0x4(%rbp)
jmp    1138 <char_needs_escaping+0x38>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<char_needs_escaping>:
cmp    $0x20,%edi
setl   %al
cmp    $0x5c,%edi
sete   %cl
cmp    $0x22,%edi
sete   %dl
or     %cl,%dl
or     %al,%dl
movzbl %dl,%eax
ret

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

LLVM IR (-O2):
define i32 @char_needs_escaping(i32 %0) {
%2 = icmp slt i32 %0, 32
%3 = icmp eq i32 %0, 92
%4 = icmp eq i32 %0, 34
%5 = or i1 %3, %4
%6 = or i1 %2, %5
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("hello, D瓜哥！\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [19 x i8] c"hello, D\E7\93\9C\E5\93\A5\EF\BC\81\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [18 x i8] c"hello, D\E7\93\9C\E5\93\A5\EF\BC\81\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int fun624() { return 624; }


x86 assembly (clang, -O0):
<fun624>:
push   %rbp
mov    %rsp,%rbp
mov    $0x270,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun624>:
mov    $0x270,%eax
ret

LLVM IR (-O0):
define i32 @fun624() {
ret i32 624
}

LLVM IR (-O2):
define i32 @fun624() {
ret i32 624
}
unsigned getiopl() {
  register unsigned i __asm__("%rax");
  asm("pushf\n"
      "pop %%rax"
      : "=r"(i));
  i = (i >> 12) & 3;
  return i;
}


x86 assembly (clang, -O0):
<getiopl>:
push   %rbp
mov    %rsp,%rbp
pushf
pop    %rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0xc,%eax
and    $0x3,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getiopl>:
pushf
pop    %rax
shr    $0xc,%eax
and    $0x3,%eax
ret

LLVM IR (-O0):
define i32 @getiopl() {
%1 = alloca i32
%2 = call i32 asm "pushf\0Apop %rax", "={rax},~{dirflag},~{fpsr},~{flags}"()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = lshr i32 %3, 12
%5 = and i32 %4, 3
store i32 %5, i32* %1
%6 = load i32, i32* %1
ret i32 %6
}

LLVM IR (-O2):
define i32 @getiopl() {
%1 = tail call i32 asm "pushf\0Apop %rax", "={rax},~{dirflag},~{fpsr},~{flags}"()
%2 = lshr i32 %1, 12
%3 = and i32 %2, 3
ret i32 %3
}
/* Variables and functions */
double ceil(double);
double floor(double);
double letround(double f) { return f > 0 ? floor(f + 0.5) : ceil(f - 0.5); }


x86 assembly (clang, -O0):
<letround>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    115b <letround+0x3b>
movsd  0xeb9(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
call   1040 <floor@plt>
movsd  %xmm0,-0x10(%rbp)
jmp    1176 <letround+0x56>
movsd  -0x8(%rbp),%xmm0
movsd  0xe98(%rip),%xmm1
subsd  %xmm1,%xmm0
call   1030 <ceil@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<letround>:
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1137 <letround+0x17>
addsd  0xed6(%rip),%xmm0
jmp    1040 <floor@plt>
addsd  0xec1(%rip),%xmm0
jmp    1030 <ceil@plt>

LLVM IR (-O0):
define double @letround(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp ogt double %3, 0.000000e+00
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = load double, double* %2
%7 = fadd double %6, 5.000000e-01
%8 = call double @llvm.floor.f64(double %7)
br label %13
9: ; preds = %1
%10 = load double, double* %2
%11 = fsub double %10, 5.000000e-01
%12 = call double @llvm.ceil.f64(double %11)
br label %13
13: ; preds = %9, %5
%14 = phi double [ %8, %5 ], [ %12, %9 ]
ret double %14
}

LLVM IR (-O2):
define double @letround(double %0) {
%2 = fcmp ogt double %0, 0.000000e+00
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = fadd double %0, 5.000000e-01
%5 = tail call double @llvm.floor.f64(double %4)
br label %9
6: ; preds = %1
%7 = fadd double %0, -5.000000e-01
%8 = tail call double @llvm.ceil.f64(double %7)
br label %9
9: ; preds = %6, %3
%10 = phi double [ %5, %3 ], [ %8, %6 ]
ret double %10
}
/* Variables and functions */
int /*<<< orphan*/ __VERIFIER_error();
int __VERIFIER_nondet_int();
int main() {
  while (1) {
    int x = __VERIFIER_nondet_int() % 100;
    if (x >= 50)
      __VERIFIER_error();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
cmpl   $0x32,-0x8(%rbp)
jl     1152 <main+0x32>
mov    $0x0,%al
call   1040 <__VERIFIER_error@plt>
jmp    112f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
cmp    $0x32,%eax
jl     1130 <main+0x10>
xor    %eax,%eax
call   1040 <__VERIFIER_error@plt>
jmp    1130 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %0, %10
%4 = call i32 (...) @__VERIFIER_nondet_int()
%5 = srem i32 %4, 100
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = icmp sge i32 %6, 50
br i1 %7, label %8, label %10
8: ; preds = %3
%9 = call i32 (...) @__VERIFIER_error()
br label %10
10: ; preds = %8, %3
br label %3
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %7, %0
%2 = tail call i32 (...) @__VERIFIER_nondet_int()
%3 = srem i32 %2, 100
%4 = icmp sgt i32 %3, 49
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 (...) @__VERIFIER_error()
br label %7
7: ; preds = %5, %1
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
void testLess() { printf("%d < %d = %d\n", 10, 4, 10 < 4); }


x86 assembly (clang, -O0):
<testLess>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0xa,%esi
mov    $0x4,%edx
xor    %ecx,%ecx
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<testLess>:
lea    0xee9(%rip),%rdi
mov    $0xa,%esi
mov    $0x4,%edx
xor    %ecx,%ecx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"%d < %d = %d\0A\00"
define void @testLess() {
%1 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 10, i32 4, i32 0)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"%d < %d = %d\0A\00"
define void @testLess() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 10, i32 4, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print_error_msg(char *, char const *);
void print_parenth(const char *what) {
  print_error_msg("%s must be in parentheses!", what);
}


x86 assembly (clang, -O0):
<print_parenth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
call   1030 <print_error_msg@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_parenth>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <print_error_msg@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"%s must be in parentheses!\00"
define void @print_parenth(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @print_error_msg(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"%s must be in parentheses!\00"
define void @print_parenth(i8* %0) {
%2 = tail call i32 @print_error_msg(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
struct genlist {
  int dummy;
};
struct fileinfo_list {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ genlist_clear(struct genlist *);
void fileinfo_list_clear(struct fileinfo_list *tthis) {
  genlist_clear((struct genlist *)tthis);
}


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

x86 assembly (clang, -O2):
<fileinfo_list_clear>:
jmp    1030 <genlist_clear@plt>

LLVM IR (-O0):
%struct.fileinfo_list = type { i32 }
%struct.genlist = type { i32 }
define void @fileinfo_list_clear(%struct.fileinfo_list* %0) {
%2 = alloca %struct.fileinfo_list*
store %struct.fileinfo_list* %0, %struct.fileinfo_list** %2
%3 = load %struct.fileinfo_list*, %struct.fileinfo_list** %2
%4 = bitcast %struct.fileinfo_list* %3 to %struct.genlist*
%5 = call i32 @genlist_clear(%struct.genlist* %4)
ret void
}

LLVM IR (-O2):
%struct.fileinfo_list = type { i32 }
%struct.genlist = type { i32 }
define void @fileinfo_list_clear(%struct.fileinfo_list* %0) {
%2 = bitcast %struct.fileinfo_list* %0 to %struct.genlist*
%3 = tail call i32 @genlist_clear(%struct.genlist* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SIG_IGN;
int sig_catch(int, int /*<<< orphan*/);
int sig_ignore(int sig) { return sig_catch(sig, SIG_IGN); }


x86 assembly (clang, -O0):
<sig_ignore>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ec3(%rip),%rax
mov    (%rax),%esi
call   1030 <sig_catch@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_ignore>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%esi
jmp    1030 <sig_catch@plt>

LLVM IR (-O0):
@SIG_IGN = global i32 0
define i32 @sig_ignore(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SIG_IGN
%5 = call i32 @sig_catch(i32 %3, i32 %4)
ret i32 %5
}

LLVM IR (-O2):
@SIG_IGN = global i32 0
define i32 @sig_ignore(i32 %0) {
%2 = load i32, i32* @SIG_IGN
%3 = tail call i32 @sig_catch(i32 %0, i32 %2)
ret i32 %3
}
int fsdE(int a, int b) {
  if (a == 0 || b == 0)
    return 0;
  while (b) {
    int r = a % b;
    a = b;
    b = r;
  }
  return a;
}


x86 assembly (clang, -O0):
<fsdE>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     111e <fsdE+0x1e>
cmpl   $0x0,-0xc(%rbp)
jne    112a <fsdE+0x2a>
movl   $0x0,-0x4(%rbp)
jmp    115a <fsdE+0x5a>
jmp    112f <fsdE+0x2f>
cmpl   $0x0,-0xc(%rbp)
je     1154 <fsdE+0x54>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    112f <fsdE+0x2f>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fsdE>:
xor    %ecx,%ecx
test   %edi,%edi
je     111b <fsdE+0x1b>
mov    %esi,%edx
test   %esi,%esi
je     111b <fsdE+0x1b>
mov    %edi,%eax
xchg   %ax,%ax
mov    %edx,%ecx
cltd
idiv   %ecx
mov    %ecx,%eax
test   %edx,%edx
jne    1110 <fsdE+0x10>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @fsdE(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
%4 = icmp eq i32 %1, 0
%5 = or i1 %3, %4
br i1 %5, label %11, label %6
6: ; preds = %2, %6
%7 = phi i32 [ %9, %6 ], [ %1, %2 ]
%8 = phi i32 [ %7, %6 ], [ %0, %2 ]
%9 = srem i32 %8, %7
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %6
11: ; preds = %6, %2
%12 = phi i32 [ 0, %2 ], [ %7, %6 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ save_move(unsigned char const *);
void save_q_castle(void) { save_move((const unsigned char *)"O-O-O"); }


x86 assembly (clang, -O0):
<save_q_castle>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <save_move@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [6 x i8] c"O-O-O\00"
define void @save_q_castle() {
%1 = call i32 @save_move(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"O-O-O\00"
define void @save_q_castle() {
%1 = tail call i32 @save_move(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int link(const char *oldpath, const char *newpath) {
  assert(!"NYI");
  return -1;
}


x86 assembly (clang, -O0):
<link>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %edi,%edi
call   1030 <assert@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<link>:
push   %rax
xor    %edi,%edi
call   1030 <assert@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"NYI\00"
define i32 @link(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = call i32 @assert(i32 0)
ret i32 -1
}

LLVM IR (-O2):
define i32 @link(i8* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = tail call i32 @assert(i32 0)
ret i32 -1
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
uint8_t pci_get_slot(uint32_t dev) { return (dev >> 8) & 0xff; }


x86 assembly (clang, -O0):
<pci_get_slot>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pci_get_slot>:
mov    %edi,%eax
movzbl %ah,%eax
ret

LLVM IR (-O0):
define i32 @pci_get_slot(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 8
%5 = and i32 %4, 255
ret i32 %5
}

LLVM IR (-O2):
define i32 @pci_get_slot(i32 %0) {
%2 = lshr i32 %0, 8
%3 = and i32 %2, 255
ret i32 %3
}
int d_bgt_mm1(double *a1, double *a2) {
  return (__builtin_isgreater(*a1, *a2));
}


x86 assembly (clang, -O0):
<d_bgt_mm1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
ucomisd (%rax),%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_bgt_mm1>:
movsd  (%rdi),%xmm0
xor    %eax,%eax
ucomisd (%rsi),%xmm0
seta   %al
ret

LLVM IR (-O0):
define i32 @d_bgt_mm1(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
store double* %0, double** %3
store double* %1, double** %4
%5 = load double*, double** %3
%6 = load double, double* %5
%7 = load double*, double** %4
%8 = load double, double* %7
%9 = fcmp ogt double %6, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @d_bgt_mm1(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = load double, double* %1
%5 = fcmp ogt double %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}