xunge/DecIR huggingface dataset:
/* Variables and functions */
int se(unsigned char const *, int, int, int *);
int read_se(const unsigned char *buffer, int *bits_offset, int *total_bits) {
  int val, bits;
  val = se(buffer, *bits_offset, *total_bits, &bits);
  *bits_offset += bits;
  *total_bits -= bits;
  return val;
}


x86 assembly (clang, -O0):
<read_se>:
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),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    -0x20(%rbp),%rcx
call   1030 <se@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x20(%rbp),%ecx
mov    -0x10(%rbp),%rax
add    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x20(%rbp),%edx
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
sub    %edx,%ecx
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_se>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
mov    (%rsi),%esi
mov    (%rdx),%edx
lea    0x4(%rsp),%rcx
call   1030 <se@plt>
mov    0x4(%rsp),%ecx
add    %ecx,(%rbx)
sub    %ecx,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @read_se(i8* %0, i32* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%9 = load i8*, i8** %4
%10 = load i32*, i32** %5
%11 = load i32, i32* %10
%12 = load i32*, i32** %6
%13 = load i32, i32* %12
%14 = call i32 @se(i8* %9, i32 %11, i32 %13, i32* %8)
store i32 %14, i32* %7
%15 = load i32, i32* %8
%16 = load i32*, i32** %5
%17 = load i32, i32* %16
%18 = add nsw i32 %17, %15
store i32 %18, i32* %16
%19 = load i32, i32* %8
%20 = load i32*, i32** %6
%21 = load i32, i32* %20
%22 = sub nsw i32 %21, %19
store i32 %22, i32* %20
%23 = load i32, i32* %7
ret i32 %23
}

LLVM IR (-O2):
define i32 @read_se(i8* %0, i32* nocapture %1, i32* nocapture %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = call i32 @se(i8* %0, i32 %6, i32 %7, i32* %4)
%9 = load i32, i32* %4
%10 = load i32, i32* %1
%11 = add nsw i32 %10, %9
store i32 %11, i32* %1
%12 = load i32, i32* %2
%13 = sub nsw i32 %12, %9
store i32 %13, i32* %2
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void lauto_free(void *ptr) {
  void **location = ptr;
  if (*location) {
    free(*location);
    *location = NULL;
  }
}


x86 assembly (clang, -O0):
<lauto_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     1149 <lauto_free+0x39>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lauto_free>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1128 <lauto_free+0x18>
call   1030 <free@plt>
movq   $0x0,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @lauto_free(i8* %0) {
%2 = alloca i8*
%3 = alloca i8**
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i8**
store i8** %5, i8*** %3
%6 = load i8**, i8*** %3
%7 = load i8*, i8** %6
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %14
9: ; preds = %1
%10 = load i8**, i8*** %3
%11 = load i8*, i8** %10
%12 = call i32 @free(i8* %11)
%13 = load i8**, i8*** %3
store i8* null, i8** %13
br label %14
14: ; preds = %9, %1
ret void
}

LLVM IR (-O2):
define void @lauto_free(i8* nocapture %0) {
%2 = bitcast i8* %0 to i8**
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @free(i8* %3)
store i8* null, i8** %2
br label %7
7: ; preds = %5, %1
ret void
}
/* Type definitions */
struct APU {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct APU *);
void apu_free(struct APU *apu) { free(apu); }


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

x86 assembly (clang, -O2):
<apu_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
%struct.APU = type { i32 }
define void @apu_free(%struct.APU* nocapture %0) {
%2 = tail call i32 @free(%struct.APU* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint32_t;

/* Variables and functions */
int is_bigendian() {
  static const union {
    uint8_t u8[4];
    uint32_t u32;
  } byte_order __attribute__((aligned(4))) = {.u8 = {1, 2, 3, 4}};
  return byte_order.u32 == 0x01020304;
}


x86 assembly (clang, -O0):
<is_bigendian>:
push   %rbp
mov    %rsp,%rbp
cmpl   $0x1020304,0xef2(%rip)
03 02 01
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%union.anon = type { [4 x i32] }
@is_bigendian.byte_order = internal constant %union.anon { [4 x i32] [i32 1, i32 2, i32 3, i32 4] }
define i32 @is_bigendian() {
%1 = load i32, i32* getelementptr inbounds (%union.anon, %union.anon* @is_bigendian.byte_order, i32 0, i32 0, i32 0)
%2 = icmp eq i32 %1, 16909060
%3 = zext i1 %2 to i32
ret i32 %3
}

LLVM IR (-O2):
define i32 @is_bigendian() {
ret i32 0
}
long dec_bin(long n) {
  long rem;
  long i = 1;
  long binary = 0;
  while (n != 0) {
    rem = n % 2;
    n /= 2;
    binary += rem * i;
    i *= 10;
  }
  return binary;
}


x86 assembly (clang, -O0):
<dec_bin>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x1,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1166 <dec_bin+0x66>
mov    -0x8(%rbp),%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
mov    %rdx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
imul   -0x18(%rbp),%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
imul   $0xa,-0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1118 <dec_bin+0x18>
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dec_bin>:
test   %rdi,%rdi
je     1146 <dec_bin+0x46>
mov    $0x1,%ecx
xor    %eax,%eax
nopl   0x0(%rax)
mov    %rdi,%rdx
shr    $0x3f,%rdx
add    %rdi,%rdx
mov    %rdx,%r8
sar    %r8
and    $0xfffffffffffffffe,%rdx
mov    %rdi,%rsi
sub    %rdx,%rsi
imul   %rcx,%rsi
add    %rsi,%rax
add    %rcx,%rcx
lea    (%rcx,%rcx,4),%rcx
add    $0x1,%rdi
cmp    $0x2,%rdi
mov    %r8,%rdi
ja     1110 <dec_bin+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @dec_bin(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %14, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %10, %3 ], [ 0, %1 ]
%5 = phi i64 [ %11, %3 ], [ 1, %1 ]
%6 = phi i64 [ %8, %3 ], [ %0, %1 ]
%7 = srem i64 %6, 2
%8 = sdiv i64 %6, 2
%9 = mul nsw i64 %7, %5
%10 = add nsw i64 %4, %9
%11 = mul nsw i64 %5, 10
%12 = add i64 %6, 1
%13 = icmp ult i64 %12, 3
br i1 %13, label %14, label %3
14: ; preds = %3, %1
%15 = phi i64 [ 0, %1 ], [ %10, %3 ]
ret i64 %15
}
int test_imm_E7int64_lowword_mem(long long *val) {
  return ((*val) & (0xE7 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_E7int64_lowword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
and    $0xe7,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_E7int64_lowword_mem>:
testb  $0xe7,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_E7int64_lowword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = and i64 %4, 231
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_E7int64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 231
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
struct timeval {
  int dummy;
};

/* Variables and functions */
int futimes(int, struct timeval const *);
int /*<<< orphan*/ perror(char *);
int testfutimes(int fd, const struct timeval tv[2]) {
  int ret;
  ret = futimes(fd, tv);
  if (ret) {
    perror("futimes");
    goto out;
  }
out:
  return ret;
}


x86 assembly (clang, -O0):
<testfutimes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <futimes@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1159 <testfutimes+0x39>
lea    0xeb1(%rip),%rdi
call   1040 <perror@plt>
jmp    115e <testfutimes+0x3e>
jmp    115e <testfutimes+0x3e>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testfutimes>:
push   %rbx
call   1030 <futimes@plt>
mov    %eax,%ebx
test   %eax,%eax
jne    1130 <testfutimes+0x10>
mov    %ebx,%eax
pop    %rbx
ret
lea    0xec9(%rip),%rdi
call   1040 <perror@plt>
jmp    112c <testfutimes+0xc>

LLVM IR (-O0):
%struct.timeval = type { i32 }
@.str = [8 x i8] c"futimes\00"
define i32 @testfutimes(i32 %0, %struct.timeval* %1) {
%3 = alloca i32
%4 = alloca %struct.timeval*
%5 = alloca i32
store i32 %0, i32* %3
store %struct.timeval* %1, %struct.timeval** %4
%6 = load i32, i32* %3
%7 = load %struct.timeval*, %struct.timeval** %4
%8 = call i32 @futimes(i32 %6, %struct.timeval* %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %14
13: ; preds = %2
br label %14
14: ; preds = %13, %11
%15 = load i32, i32* %5
ret i32 %15
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
@.str = [8 x i8] c"futimes\00"
define i32 @testfutimes(i32 %0, %struct.timeval* %1) {
%3 = tail call i32 @futimes(i32 %0, %struct.timeval* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %2, %5
ret i32 %3
}
void XtCvtStringToFont() {}


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

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

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

LLVM IR (-O2):
define void @XtCvtStringToFont() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sendNMEAMsgAndChecksum(void *, char const *,
                                          int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char const *);
void configureUBLOX(void *port) {
  static const char msg[] = "$PUBX,41,1,0001,0001,115200,0*";
  sendNMEAMsgAndChecksum(port, msg, strlen(msg));
}


x86 assembly (clang, -O0):
<configureUBLOX>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    0xec5(%rip),%rdi
call   1030 <strlen@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%edx
lea    0xeb3(%rip),%rsi
call   1040 <sendNMEAMsgAndChecksum@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<configureUBLOX>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xed2(%rip),%r14
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <sendNMEAMsgAndChecksum@plt>

LLVM IR (-O0):
@configureUBLOX.msg = internal constant [31 x i8] c"$PUBX,41,1,0001,0001,115200,0*\00"
define void @configureUBLOX(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @strlen(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @configureUBLOX.msg, i64 0, i64 0))
%5 = call i32 @sendNMEAMsgAndChecksum(i8* %3, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @configureUBLOX.msg, i64 0, i64 0), i32 %4)
ret void
}

LLVM IR (-O2):
@configureUBLOX.msg = internal constant [31 x i8] c"$PUBX,41,1,0001,0001,115200,0*\00"
define void @configureUBLOX(i8* %0) {
%2 = tail call i32 @strlen(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @configureUBLOX.msg, i64 0, i64 0))
%3 = tail call i32 @sendNMEAMsgAndChecksum(i8* %0, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @configureUBLOX.msg, i64 0, i64 0), i32 %2)
ret void
}
char match(char ch) {
  switch (ch) {
  case '(':
    return ')';
  case ')':
    return '(';
  case '[':
    return ']';
  case ']':
    return '[';
  case '{':
    return '}';
  case '}':
    return '{';
  default:
    return ch;
  }
}


x86 assembly (clang, -O0):
<match>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x28,%eax
je     1174 <match+0x74>
jmp    111f <match+0x1f>
mov    -0x8(%rbp),%eax
sub    $0x29,%eax
je     117d <match+0x7d>
jmp    1130 <match+0x30>
mov    -0x8(%rbp),%eax
sub    $0x5b,%eax
je     1186 <match+0x86>
jmp    1141 <match+0x41>
mov    -0x8(%rbp),%eax
sub    $0x5d,%eax
je     118f <match+0x8f>
jmp    1152 <match+0x52>
mov    -0x8(%rbp),%eax
sub    $0x7b,%eax
je     1198 <match+0x98>
jmp    1163 <match+0x63>
mov    -0x8(%rbp),%eax
sub    $0x7d,%eax
je     11a1 <match+0xa1>
jmp    11aa <match+0xaa>
movb   $0x29,-0x1(%rbp)
jmp    11b0 <match+0xb0>
movb   $0x28,-0x1(%rbp)
jmp    11b0 <match+0xb0>
movb   $0x5d,-0x1(%rbp)
jmp    11b0 <match+0xb0>
movb   $0x5b,-0x1(%rbp)
jmp    11b0 <match+0xb0>
movb   $0x7d,-0x1(%rbp)
jmp    11b0 <match+0xb0>
movb   $0x7b,-0x1(%rbp)
jmp    11b0 <match+0xb0>
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<match>:
mov    %edi,%eax
lea    -0x5b(%rax),%ecx
cmp    $0x22,%ecx
ja     111d <match+0x1d>
lea    0xeef(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0x5d,%al
ret
cmp    $0x28,%eax
je     1133 <match+0x33>
cmp    $0x29,%eax
jne    1132 <match+0x32>
mov    $0x28,%al
ret
mov    $0x5b,%al
ret
mov    $0x7d,%al
ret
mov    $0x7b,%al
ret
mov    $0x29,%al
ret

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

LLVM IR (-O2):
define signext i8 @match(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %8 [
i32 40, label %9
i32 41, label %3
i32 91, label %4
i32 93, label %5
i32 123, label %6
i32 125, label %7
]
3: ; preds = %1
br label %9
4: ; preds = %1
br label %9
5: ; preds = %1
br label %9
6: ; preds = %1
br label %9
7: ; preds = %1
br label %9
8: ; preds = %1
br label %9
9: ; preds = %1, %8, %7, %6, %5, %4, %3
%10 = phi i8 [ %0, %8 ], [ 123, %7 ], [ 125, %6 ], [ 91, %5 ], [ 93, %4 ], [ 40, %3 ], [ 41, %1 ]
ret i8 %10
}
double sgn(x)
double x;
{
  double value = 0.0;
  if (x > 0.0)
    value = 1.0;
  if (x < 0.0)
    value = -1.0;
  return value;
}


x86 assembly (clang, -O0):
<sgn>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1130 <sgn+0x30>
movsd  0xed5(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    114b <sgn+0x4b>
movsd  0xec2(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<sgn>:
xorpd  %xmm1,%xmm1
xorpd  %xmm2,%xmm2
cmpltsd %xmm0,%xmm2
movsd  0xeeb(%rip),%xmm3
andpd  %xmm2,%xmm3
cmpltsd %xmm1,%xmm0
movapd %xmm0,%xmm1
andnpd %xmm3,%xmm1
movsd  0xeda(%rip),%xmm2
andpd  %xmm2,%xmm0
orpd   %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @sgn(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
store double 0.000000e+00, double* %3
%4 = load double, double* %2
%5 = fcmp ogt double %4, 0.000000e+00
br i1 %5, label %6, label %7
6: ; preds = %1
store double 1.000000e+00, double* %3
br label %7
7: ; preds = %6, %1
%8 = load double, double* %2
%9 = fcmp olt double %8, 0.000000e+00
br i1 %9, label %10, label %11
10: ; preds = %7
store double -1.000000e+00, double* %3
br label %11
11: ; preds = %10, %7
%12 = load double, double* %3
ret double %12
}

LLVM IR (-O2):
define double @sgn(double %0) {
%2 = fcmp ogt double %0, 0.000000e+00
%3 = select i1 %2, double 1.000000e+00, double 0.000000e+00
%4 = fcmp olt double %0, 0.000000e+00
%5 = select i1 %4, double -1.000000e+00, double %3
ret double %5
}
int compareInt(int *t, int *d) {
  if (*t > *d)
    return 1;
  else if (*t < *d)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<compareInt>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jle    112a <compareInt+0x2a>
movl   $0x1,-0x4(%rbp)
jmp    1154 <compareInt+0x54>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jge    1148 <compareInt+0x48>
movl   $0xffffffff,-0x4(%rbp)
jmp    1154 <compareInt+0x54>
jmp    114d <compareInt+0x4d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compareInt>:
mov    (%rdi),%eax
mov    (%rsi),%ecx
xor    %edx,%edx
cmp    %ecx,%eax
setl   %dl
neg    %edx
cmp    %ecx,%eax
mov    $0x1,%eax
cmovle %edx,%eax
ret

LLVM IR (-O0):
define i32 @compareInt(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** %4
%7 = load i32, i32* %6
%8 = load i32*, i32** %5
%9 = load i32, i32* %8
%10 = icmp sgt i32 %7, %9
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 1, i32* %3
br label %21
12: ; preds = %2
%13 = load i32*, i32** %4
%14 = load i32, i32* %13
%15 = load i32*, i32** %5
%16 = load i32, i32* %15
%17 = icmp slt i32 %14, %16
br i1 %17, label %18, label %19
18: ; preds = %12
store i32 -1, i32* %3
br label %21
19: ; preds = %12
br label %20
20: ; preds = %19
store i32 0, i32* %3
br label %21
21: ; preds = %20, %18, %11
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
define i32 @compareInt(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
%5 = icmp sgt i32 %3, %4
%6 = icmp slt i32 %3, %4
%7 = sext i1 %6 to i32
%8 = select i1 %5, i32 1, i32 %7
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ _PROCEDURE_LINKAGE_TABLE_();
void __udiv64() {
  _PROCEDURE_LINKAGE_TABLE_();
  return;
}


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

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

LLVM IR (-O0):
define void @__udiv64() {
%1 = call i32 (...) @_PROCEDURE_LINKAGE_TABLE_()
ret void
}

LLVM IR (-O2):
define void @__udiv64() {
%1 = tail call i32 (...) @_PROCEDURE_LINKAGE_TABLE_()
ret void
}
int test_imm_F9uint16_mem(unsigned short *val) {
  return ((*val) & (0xF9 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_F9uint16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzwl (%rax),%edx
and    $0xf9,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_F9uint16_mem>:
testb  $0xf9,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_F9uint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = zext i16 %4 to i32
%6 = and i32 %5, 249
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_F9uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 249
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
struct stmt {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ interp(struct stmt *);
int maxargs(struct stmt *);
int /*<<< orphan*/ printf(char *, int);
struct stmt *prog();
int main(void) {
  struct stmt *init_s = prog();
  printf("maxargs(prog()) -> %d\n", maxargs(init_s));
  interp(init_s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <prog@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <maxargs@plt>
mov    %eax,%esi
lea    0xe94(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <interp@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1060 <prog@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <maxargs@plt>
lea    0xea6(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <interp@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.stmt = type { i32 }
@.str = [23 x i8] c"maxargs(prog()) -> %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.stmt*
store i32 0, i32* %1
%3 = call %struct.stmt* (...) @prog()
store %struct.stmt* %3, %struct.stmt** %2
%4 = load %struct.stmt*, %struct.stmt** %2
%5 = call i32 @maxargs(%struct.stmt* %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load %struct.stmt*, %struct.stmt** %2
%8 = call i32 @interp(%struct.stmt* %7)
ret i32 0
}

LLVM IR (-O2):
%struct.stmt = type { i32 }
@.str = [23 x i8] c"maxargs(prog()) -> %d\0A\00"
define i32 @main() {
%1 = tail call %struct.stmt* (...) @prog()
%2 = tail call i32 @maxargs(%struct.stmt* %1)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = tail call i32 @interp(%struct.stmt* %1)
ret i32 0
}
/* Variables and functions */
char *longestCommonPrefix(char **, int);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char **argv) {
  char *s[] = {"aba", "ababb", "abc"};
  printf("output:%s \n", longestCommonPrefix(s, 3));
  ;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2cc3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2cc0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2cbd(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x3,%esi
call   1030 <longestCommonPrefix@plt>
mov    %rax,%rsi
lea    0xe9f(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0x2ce5(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0x2cc9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x3,%esi
call   1030 <longestCommonPrefix@plt>
lea    0xebf(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"aba\00"
@.str.1 = [6 x i8] c"ababb\00"
@.str.2 = [4 x i8] c"abc\00"
@__const.main.s = [3 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0)]
@.str.3 = [12 x i8] c"output:%s \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [3 x i8*]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = bitcast [3 x i8*]* %6 to i8*
%8 = getelementptr inbounds [3 x i8*], [3 x i8*]* %6, i64 0, i64 0
%9 = call i8* @longestCommonPrefix(i8** %8, i32 3)
%10 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"aba\00"
@.str.1 = [6 x i8] c"ababb\00"
@.str.2 = [4 x i8] c"abc\00"
@__const.main.s = [3 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0)]
@.str.3 = [12 x i8] c"output:%s \0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [3 x i8*]
%4 = bitcast [3 x i8*]* %3 to i8*
%5 = getelementptr inbounds [3 x i8*], [3 x i8*]* %3, i64 0, i64 0
%6 = call i8* @longestCommonPrefix(i8** %5, i32 3)
%7 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* %6)
ret i32 0
}
/* Variables and functions */
extern void vec_pop(void *vec) {
  if ((*(size_t *)(((char *)vec - (sizeof(size_t) * 3)) + sizeof(size_t))) >
      0) {
    --(*(size_t *)(((char *)vec - (sizeof(size_t) * 3)) + sizeof(size_t)));
  }
}


x86 assembly (clang, -O0):
<vec_pop>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,-0x10(%rax)
jbe    1127 <vec_pop+0x27>
mov    -0x8(%rbp),%rax
mov    -0x10(%rax),%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec_pop>:
mov    -0x10(%rdi),%rax
test   %rax,%rax
je     1111 <vec_pop+0x11>
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rdi)
ret

LLVM IR (-O0):
define void @vec_pop(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 -24
%5 = getelementptr inbounds i8, i8* %4, i64 8
%6 = bitcast i8* %5 to i64*
%7 = load i64, i64* %6
%8 = icmp ugt i64 %7, 0
br i1 %8, label %9, label %16
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i64 -24
%12 = getelementptr inbounds i8, i8* %11, i64 8
%13 = bitcast i8* %12 to i64*
%14 = load i64, i64* %13
%15 = add i64 %14, -1
store i64 %15, i64* %13
br label %16
16: ; preds = %9, %1
ret void
}

LLVM IR (-O2):
define void @vec_pop(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 -16
%3 = bitcast i8* %2 to i64*
%4 = load i64, i64* %3
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = add i64 %4, -1
store i64 %7, i64* %3
br label %8
8: ; preds = %6, %1
ret void
}
void strip_spaces(char *str) {
  for (; *str != '\0'; str++) {
    if (*str == ' ')
      *str = '\0';
  }
  return;
}


x86 assembly (clang, -O0):
<strip_spaces>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1145 <strip_spaces+0x45>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    112f <strip_spaces+0x2f>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
jmp    1134 <strip_spaces+0x34>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <strip_spaces+0x8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<strip_spaces>:
jmp    1117 <strip_spaces+0x17>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movb   $0x0,(%rdi)
add    $0x1,%rdi
movzbl (%rdi),%eax
cmp    $0x20,%al
je     1110 <strip_spaces+0x10>
test   %al,%al
jne    1113 <strip_spaces+0x13>
ret

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

LLVM IR (-O2):
define void @strip_spaces(i8* nocapture %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 32, label %5
]
5: ; preds = %2
store i8 0, i8* %3
br label %6
6: ; preds = %2, %5
%7 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
8: ; preds = %2
ret void
}
/* Variables and functions */
int klog(char);
int /*<<< orphan*/ strcat(char, char *);
int logerror(char *error) {
  char *error_tag = "Error! : ";
  strcat(*error_tag, error);
  int ret = klog(*error_tag);
  return (ret);
}


x86 assembly (clang, -O0):
<logerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1040 <strcat@plt>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <klog@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logerror>:
push   %rax
mov    %rdi,%rsi
mov    $0x45,%edi
call   1040 <strcat@plt>
mov    $0x45,%edi
pop    %rax
jmp    1030 <klog@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"Error! : \00"
define i32 @logerror(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %3
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = load i8*, i8** %2
%8 = call i32 @strcat(i8 signext %6, i8* %7)
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
%11 = call i32 @klog(i8 signext %10)
store i32 %11, i32* %4
%12 = load i32, i32* %4
ret i32 %12
}

LLVM IR (-O2):
define i32 @logerror(i8* %0) {
%2 = tail call i32 @strcat(i8 signext 69, i8* %0)
%3 = tail call i32 @klog(i8 signext 69)
ret i32 %3
}
not_builtin() {}


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

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

LLVM IR (-O0):
define i32 @not_builtin() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @not_builtin() {
ret i32 undef
}
/* Variables and functions */
int f(scalar_t__);
scalar_t__ g();
scalar_t__ h();
main() { return f(g() + h()); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <g@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <h@plt>
mov    -0x10(%rbp),%rdi
add    %rax,%rdi
call   1040 <f@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1050 <g@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1030 <h@plt>
add    %rax,%rbx
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <f@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 (...) @g()
%3 = call i64 (...) @h()
%4 = add nsw i64 %2, %3
%5 = call i32 @f(i64 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 (...) @g()
%2 = tail call i64 (...) @h()
%3 = add nsw i64 %2, %1
%4 = tail call i32 @f(i64 %3)
ret i32 %4
}
unsigned int Cust_GetBacklightLevelSupport_byPWM(void) { return 256; }


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

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

LLVM IR (-O0):
define i32 @Cust_GetBacklightLevelSupport_byPWM() {
ret i32 256
}

LLVM IR (-O2):
define i32 @Cust_GetBacklightLevelSupport_byPWM() {
ret i32 256
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void msg_print(char *info) { printf("%s", info); }


x86 assembly (clang, -O0):
<msg_print>:
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):
<msg_print>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @msg_print(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 @msg_print(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*/ deduplicate_strings(char const **, size_t);
char *join_strings(char const **, size_t, char);
char *ipaddr_string(const char **addrs, size_t addrs_len) {
  deduplicate_strings(addrs, addrs_len);
  return join_strings(addrs, addrs_len, ',');
}


x86 assembly (clang, -O0):
<ipaddr_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <deduplicate_strings@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x2c,%edx
call   1030 <join_strings@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ipaddr_string>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <deduplicate_strings@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x2c,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <join_strings@plt>

LLVM IR (-O0):
define i8* @ipaddr_string(i8** %0, i64 %1) {
%3 = alloca i8**
%4 = alloca i64
store i8** %0, i8*** %3
store i64 %1, i64* %4
%5 = load i8**, i8*** %3
%6 = load i64, i64* %4
%7 = call i32 @deduplicate_strings(i8** %5, i64 %6)
%8 = load i8**, i8*** %3
%9 = load i64, i64* %4
%10 = call i8* @join_strings(i8** %8, i64 %9, i8 signext 44)
ret i8* %10
}

LLVM IR (-O2):
define i8* @ipaddr_string(i8** %0, i64 %1) {
%3 = tail call i32 @deduplicate_strings(i8** %0, i64 %1)
%4 = tail call i8* @join_strings(i8** %0, i64 %1, i8 signext 44)
ret i8* %4
}
void INT_Excep_FloatingPoint(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_FloatingPoint() {
ret void
}
/* Type definitions */
struct Cyc_Absyn_Exp {
  int dummy;
};

/* Variables and functions */
struct Cyc_Absyn_Exp *Cyc_Absyn_prim2_exp(unsigned int, struct Cyc_Absyn_Exp *,
                                          struct Cyc_Absyn_Exp *, unsigned int);
struct Cyc_Absyn_Exp *Cyc_Absyn_udivide_exp(struct Cyc_Absyn_Exp *e1,
                                            struct Cyc_Absyn_Exp *e2,
                                            unsigned loc) {
  struct Cyc_Absyn_Exp *_T0;
  _T0 = Cyc_Absyn_prim2_exp(20U, e1, e2, loc);
  return _T0;
}


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

x86 assembly (clang, -O2):
<Cyc_Absyn_udivide_exp>:
mov    %edx,%ecx
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    $0x14,%edi
jmp    1030 <Cyc_Absyn_prim2_exp@plt>

LLVM IR (-O0):
%struct.Cyc_Absyn_Exp = type { i32 }
define %struct.Cyc_Absyn_Exp* @Cyc_Absyn_udivide_exp(%struct.Cyc_Absyn_Exp* %0, %struct.Cyc_Absyn_Exp* %1, i32 %2) {
%4 = alloca %struct.Cyc_Absyn_Exp*
%5 = alloca %struct.Cyc_Absyn_Exp*
%6 = alloca i32
%7 = alloca %struct.Cyc_Absyn_Exp*
store %struct.Cyc_Absyn_Exp* %0, %struct.Cyc_Absyn_Exp** %4
store %struct.Cyc_Absyn_Exp* %1, %struct.Cyc_Absyn_Exp** %5
store i32 %2, i32* %6
%8 = load %struct.Cyc_Absyn_Exp*, %struct.Cyc_Absyn_Exp** %4
%9 = load %struct.Cyc_Absyn_Exp*, %struct.Cyc_Absyn_Exp** %5
%10 = load i32, i32* %6
%11 = call %struct.Cyc_Absyn_Exp* @Cyc_Absyn_prim2_exp(i32 20, %struct.Cyc_Absyn_Exp* %8, %struct.Cyc_Absyn_Exp* %9, i32 %10)
store %struct.Cyc_Absyn_Exp* %11, %struct.Cyc_Absyn_Exp** %7
%12 = load %struct.Cyc_Absyn_Exp*, %struct.Cyc_Absyn_Exp** %7
ret %struct.Cyc_Absyn_Exp* %12
}

LLVM IR (-O2):
%struct.Cyc_Absyn_Exp = type { i32 }
define %struct.Cyc_Absyn_Exp* @Cyc_Absyn_udivide_exp(%struct.Cyc_Absyn_Exp* %0, %struct.Cyc_Absyn_Exp* %1, i32 %2) {
%4 = tail call %struct.Cyc_Absyn_Exp* @Cyc_Absyn_prim2_exp(i32 20, %struct.Cyc_Absyn_Exp* %0, %struct.Cyc_Absyn_Exp* %1, i32 %2)
ret %struct.Cyc_Absyn_Exp* %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i;
  scanf("%d", &i);
  printf("Hello World %d \n", i);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [17 x i8] c"Hello World %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret i32 0
}
void hc05_enter_at(void) {
  (*(volatile unsigned int *)(0x7F008164)) |= 0x100;
  return;
}


x86 assembly (clang, -O0):
<hc05_enter_at>:
push   %rbp
mov    %rsp,%rbp
mov    $0x7f008164,%eax
mov    (%rax),%ecx
or     $0x100,%ecx
mov    $0x7f008164,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<hc05_enter_at>:
orl    $0x100,0x7f008164
ret

LLVM IR (-O0):
define void @hc05_enter_at() {
%1 = load volatile i32, i32* inttoptr (i64 2130739556 to i32*)
%2 = or i32 %1, 256
store volatile i32 %2, i32* inttoptr (i64 2130739556 to i32*)
ret void
}

LLVM IR (-O2):
define void @hc05_enter_at() {
%1 = load volatile i32, i32* inttoptr (i64 2130739556 to i32*)
%2 = or i32 %1, 256
store volatile i32 %2, i32* inttoptr (i64 2130739556 to i32*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test(int);
int main(void) {
  test(0);
  test(5);
  test(10);
  test(25);
  test(1808548329);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <test@plt>
mov    $0x5,%edi
call   1030 <test@plt>
mov    $0xa,%edi
call   1030 <test@plt>
mov    $0x19,%edi
call   1030 <test@plt>
mov    $0x6bcc41e9,%edi
call   1030 <test@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <test@plt>
mov    $0x5,%edi
call   1030 <test@plt>
mov    $0xa,%edi
call   1030 <test@plt>
mov    $0x19,%edi
call   1030 <test@plt>
mov    $0x6bcc41e9,%edi
call   1030 <test@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @test(i32 0)
%2 = call i32 @test(i32 5)
%3 = call i32 @test(i32 10)
%4 = call i32 @test(i32 25)
%5 = call i32 @test(i32 1808548329)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @test(i32 0)
%2 = tail call i32 @test(i32 5)
%3 = tail call i32 @test(i32 10)
%4 = tail call i32 @test(i32 25)
%5 = tail call i32 @test(i32 1808548329)
ret i32 0
}
double fbxor(double a, double b) { return (int)a ^ (int)b; }


x86 assembly (clang, -O0):
<fbxor>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
cvttsd2si -0x8(%rbp),%eax
cvttsd2si -0x10(%rbp),%ecx
xor    %ecx,%eax
cvtsi2sd %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fbxor>:
cvttsd2si %xmm0,%eax
cvttsd2si %xmm1,%ecx
xor    %eax,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
ret

LLVM IR (-O0):
define double @fbxor(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 = fptosi double %5 to i32
%7 = load double, double* %4
%8 = fptosi double %7 to i32
%9 = xor i32 %6, %8
%10 = sitofp i32 %9 to double
ret double %10
}

LLVM IR (-O2):
define double @fbxor(double %0, double %1) {
%3 = fptosi double %0 to i32
%4 = fptosi double %1 to i32
%5 = xor i32 %4, %3
%6 = sitofp i32 %5 to double
ret double %6
}
/* Variables and functions */
int strcmp(char const *, char const *);
int strcmp_or_null(const char *a, const char *b) {
  if (a && b)
    return strcmp(a, b);
  return 1;
}


x86 assembly (clang, -O0):
<strcmp_or_null>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114b <strcmp_or_null+0x3b>
cmpq   $0x0,-0x18(%rbp)
je     114b <strcmp_or_null+0x3b>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcmp@plt>
mov    %eax,-0x4(%rbp)
jmp    1152 <strcmp_or_null+0x42>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcmp_or_null>:
test   %rdi,%rdi
je     111f <strcmp_or_null+0xf>
test   %rsi,%rsi
je     111f <strcmp_or_null+0xf>
jmp    1030 <strcmp@plt>
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @strcmp_or_null(i8* %0, i8* %1) {
%3 = icmp ne i8* %0, null
%4 = icmp ne i8* %1, null
%5 = and i1 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @strcmp(i8* %0, i8* %1)
br label %8
8: ; preds = %2, %6
%9 = phi i32 [ %7, %6 ], [ 1, %2 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ serial0_flush();
int /*<<< orphan*/ serial1_flush();
void FlushCOM(int portnum) {
  if (portnum == 0)
    serial0_flush();
  else
    serial1_flush();
}


x86 assembly (clang, -O0):
<FlushCOM>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1141 <FlushCOM+0x21>
mov    $0x0,%al
call   1030 <serial0_flush@plt>
jmp    1148 <FlushCOM+0x28>
mov    $0x0,%al
call   1040 <serial1_flush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FlushCOM>:
xor    %eax,%eax
test   %edi,%edi
je     112b <FlushCOM+0xb>
jmp    1040 <serial1_flush@plt>
jmp    1030 <serial0_flush@plt>

LLVM IR (-O0):
define void @FlushCOM(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (...) @serial0_flush()
br label %9
7: ; preds = %1
%8 = call i32 (...) @serial1_flush()
br label %9
9: ; preds = %7, %5
ret void
}

LLVM IR (-O2):
define void @FlushCOM(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (...) @serial0_flush()
br label %7
5: ; preds = %1
%6 = tail call i32 (...) @serial1_flush()
br label %7
7: ; preds = %5, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ halt();
int main(void) {
  halt();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <halt@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @halt()
ret i32 0
}
void menu_open(void) { return; }


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

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

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

LLVM IR (-O2):
define void @menu_open() {
ret void
}
/* Variables and functions */
double recursive(double a) {
  if (a < 10)
    return a;
  return recursive(3.33);
}


x86 assembly (clang, -O0):
<recursive>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  0xedb(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    113f <recursive+0x2f>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1151 <recursive+0x41>
movsd  0xec1(%rip),%xmm0
call   1030 <recursive@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<recursive>:
movapd %xmm0,%xmm1
cmpltsd 0xef3(%rip),%xmm1
andpd  %xmm1,%xmm0
movsd  0xeef(%rip),%xmm2
andnpd %xmm2,%xmm1
orpd   %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @recursive(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp olt double %4, 1.000000e+01
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load double, double* %3
store double %7, double* %2
br label %10
8: ; preds = %1
%9 = call double @recursive(double 3.330000e+00)
store double %9, double* %2
br label %10
10: ; preds = %8, %6
%11 = load double, double* %2
ret double %11
}

LLVM IR (-O2):
define double @recursive(double %0) {
%2 = fcmp olt double %0, 1.000000e+01
%3 = select i1 %2, double %0, double 3.330000e+00
ret double %3
}