xunge/DecIR huggingface dataset:
void EthernetPHYAddrSet(unsigned long ulBase, unsigned char ucAddr) {
  ;
  while ((*((volatile unsigned long *)(ulBase + 0x00000020))) & 0x00000001) {
  }
  (*((volatile unsigned long *)(ulBase + 0x00000028))) = ucAddr;
}


x86 assembly (clang, -O0):
<EthernetPHYAddrSet>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    0x20(%rax),%rax
and    $0x1,%rax
cmp    $0x0,%rax
je     1129 <EthernetPHYAddrSet+0x29>
jmp    110e <EthernetPHYAddrSet+0xe>
movzbl -0x9(%rbp),%eax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %rcx,0x28(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<EthernetPHYAddrSet>:
mov    0x20(%rdi),%rax
test   $0x1,%al
jne    1100 <EthernetPHYAddrSet>
movzbl %sil,%eax
mov    %rax,0x28(%rdi)
ret

LLVM IR (-O0):
define void @EthernetPHYAddrSet(i64 %0, i8 zeroext %1) {
%3 = alloca i64
%4 = alloca i8
store i64 %0, i64* %3
store i8 %1, i8* %4
br label %5
5: ; preds = %12, %2
%6 = load i64, i64* %3
%7 = add i64 %6, 32
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
%10 = and i64 %9, 1
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %5
br label %5
13: ; preds = %5
%14 = load i8, i8* %4
%15 = zext i8 %14 to i64
%16 = load i64, i64* %3
%17 = add i64 %16, 40
%18 = inttoptr i64 %17 to i64*
store volatile i64 %15, i64* %18
ret void
}

LLVM IR (-O2):
define void @EthernetPHYAddrSet(i64 %0, i8 zeroext %1) {
%3 = add i64 %0, 32
%4 = inttoptr i64 %3 to i64*
br label %5
5: ; preds = %5, %2
%6 = load volatile i64, i64* %4
%7 = and i64 %6, 1
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %5
9: ; preds = %5
%10 = zext i8 %1 to i64
%11 = add i64 %0, 40
%12 = inttoptr i64 %11 to i64*
store volatile i64 %10, i64* %12
ret void
}
/* Variables and functions */
int /*<<< orphan*/ delay_us(int);
void delay_ms(int ms) { delay_us(1000 / 8 * ms); }


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

x86 assembly (clang, -O2):
<delay_ms>:
imul   $0x7d,%edi,%edi
jmp    1030 <delay_us@plt>

LLVM IR (-O0):
define void @delay_ms(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 125, %3
%5 = call i32 @delay_us(i32 %4)
ret void
}

LLVM IR (-O2):
define void @delay_ms(i32 %0) {
%2 = mul nsw i32 %0, 125
%3 = tail call i32 @delay_us(i32 %2)
ret void
}
swap(int *a, int *b) {
  int temp = *a;
  *a = *b;
  *b = temp;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @swap(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 = load i32, i32* %7
store i32 %8, i32* %6
%9 = load i32*, i32** %5
%10 = load i32, i32* %9
%11 = load i32*, i32** %4
store i32 %10, i32* %11
%12 = load i32, i32* %6
%13 = load i32*, i32** %5
store i32 %12, i32* %13
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @swap(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
store i32 %4, i32* %0
store i32 %3, i32* %1
ret i32 undef
}
int hash(name)
char *name;
{
  int sum;
  for (sum = 0; *name != '\0'; name++)
    sum += (sum + *name);
  sum %= 101;
  if (sum < 0)
    sum += 101;
  return (sum);
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1142 <hash+0x42>
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
movsbl (%rcx),%ecx
add    %ecx,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <hash+0xf>
mov    -0xc(%rbp),%eax
mov    $0x65,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1163 <hash+0x63>
mov    -0xc(%rbp),%eax
add    $0x65,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%al
test   %al,%al
je     114b <hash+0x4b>
add    $0x1,%rdi
xor    %ecx,%ecx
nopl   0x0(%rax)
movsbl %al,%eax
lea    (%rax,%rcx,2),%ecx
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <hash+0x10>
movslq %ecx,%rax
imul   $0x288df0cb,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x24,%rcx
add    %edx,%ecx
imul   $0x65,%ecx,%ecx
mov    %eax,%edx
sub    %ecx,%edx
neg    %ecx
test   %edx,%edx
lea    0x65(%rax,%rcx,1),%eax
cmovns %edx,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %19, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %10, %4 ], [ 0, %1 ]
%7 = phi i8* [ %11, %4 ], [ %0, %1 ]
%8 = sext i8 %5 to i32
%9 = shl i32 %6, 1
%10 = add i32 %9, %8
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = srem i32 %10, 101
%16 = icmp slt i32 %15, 0
%17 = add nsw i32 %15, 101
%18 = select i1 %16, i32 %17, i32 %15
br label %19
19: ; preds = %14, %1
%20 = phi i32 [ 0, %1 ], [ %18, %14 ]
ret i32 %20
}
/* Variables and functions */
int /*<<< orphan*/ left_motor(int);
int /*<<< orphan*/ right_motor(int);
void turn_backward(int speed) {
  left_motor(-speed);
  right_motor(-speed);
}


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

x86 assembly (clang, -O2):
<turn_backward>:
push   %rbx
mov    %edi,%ebx
neg    %ebx
mov    %ebx,%edi
call   1030 <left_motor@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <right_motor@plt>

LLVM IR (-O0):
define void @turn_backward(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 0, %3
%5 = call i32 @left_motor(i32 %4)
%6 = load i32, i32* %2
%7 = sub nsw i32 0, %6
%8 = call i32 @right_motor(i32 %7)
ret void
}

LLVM IR (-O2):
define void @turn_backward(i32 %0) {
%2 = sub nsw i32 0, %0
%3 = tail call i32 @left_motor(i32 %2)
%4 = tail call i32 @right_motor(i32 %2)
ret void
}
/* Type definitions */
typedef int int8_t;
typedef int int32_t;

/* Variables and functions */
int8_t rotateL_fun_int8_t(int8_t x, int32_t i) {
  if ((i %= 8) == 0)
    return x;
  return (x << i) | ((0x7f >> (7 - i)) & (x >> (8 - i)));
}


x86 assembly (clang, -O0):
<rotateL_fun_int8_t>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
cmp    $0x0,%edx
jne    112c <rotateL_fun_int8_t+0x2c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115d <rotateL_fun_int8_t+0x5d>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    %cl,%eax
mov    $0x7,%ecx
sub    -0xc(%rbp),%ecx
mov    $0x7f,%edx
sar    %cl,%edx
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%edx
mov    $0x8,%ecx
sub    -0xc(%rbp),%ecx
sar    %cl,%edx
mov    -0x10(%rbp),%ecx
and    %edx,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotateL_fun_int8_t>:
mov    %edi,%eax
lea    0x7(%rsi),%ecx
test   %esi,%esi
cmovns %esi,%ecx
and    $0xfffffff8,%ecx
sub    %ecx,%esi
je     112e <rotateL_fun_int8_t+0x2e>
mov    %eax,%edx
mov    %esi,%ecx
shl    %cl,%edx
mov    $0x7,%cl
sub    %sil,%cl
mov    $0x7f,%edi
shr    %cl,%edi
mov    $0x8,%cl
sub    %sil,%cl
sar    %cl,%eax
and    %edi,%eax
or     %edx,%eax
ret

LLVM IR (-O0):
define i32 @rotateL_fun_int8_t(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 = srem i32 %6, 8
store i32 %7, i32* %5
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load i32, i32* %4
store i32 %10, i32* %3
br label %24
11: ; preds = %2
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = shl i32 %12, %13
%15 = load i32, i32* %5
%16 = sub nsw i32 7, %15
%17 = ashr i32 127, %16
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = sub nsw i32 8, %19
%21 = ashr i32 %18, %20
%22 = and i32 %17, %21
%23 = or i32 %14, %22
store i32 %23, i32* %3
br label %24
24: ; preds = %11, %9
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @rotateL_fun_int8_t(i32 %0, i32 %1) {
%3 = srem i32 %1, 8
%4 = icmp eq i32 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2
%6 = shl i32 %0, %3
%7 = sub nsw i32 7, %3
%8 = lshr i32 127, %7
%9 = sub nsw i32 8, %3
%10 = ashr i32 %0, %9
%11 = and i32 %8, %10
%12 = or i32 %11, %6
br label %13
13: ; preds = %2, %5
%14 = phi i32 [ %12, %5 ], [ %0, %2 ]
ret i32 %14
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
scalar_t__ MALLOC(int);
int /*<<< orphan*/ localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ strftime(char *, int, char *, int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
char *date_stamp(void) {
  time_t t;
  char *t_stamp;
  t_stamp = (char *)MALLOC(25 * sizeof(char));
  t = time(NULL);
  strftime(t_stamp, 12, "%d-%b-%Y", localtime(&t));
  return t_stamp;
}


x86 assembly (clang, -O0):
<date_stamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x19,%edi
call   1050 <MALLOC@plt>
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%ecx
mov    $0xc,%esi
lea    0xe7b(%rip),%rdx
call   1060 <strftime@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<date_stamp>:
push   %rbx
sub    $0x10,%rsp
mov    $0x19,%edi
call   1050 <MALLOC@plt>
mov    %rax,%rbx
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
lea    0xe92(%rip),%rdx
mov    %rbx,%rdi
mov    $0xc,%esi
mov    %eax,%ecx
call   1060 <strftime@plt>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%d-%b-%Y\00"
define i8* @date_stamp() {
%1 = alloca i32
%2 = alloca i8*
%3 = call i64 @MALLOC(i32 25)
%4 = inttoptr i64 %3 to i8*
store i8* %4, i8** %2
%5 = call i32 @time(i32* null)
store i32 %5, i32* %1
%6 = load i8*, i8** %2
%7 = call i32 @localtime(i32* %1)
%8 = call i32 @strftime(i8* %6, i32 12, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i8*, i8** %2
ret i8* %9
}

LLVM IR (-O2):
@.str = [9 x i8] c"%d-%b-%Y\00"
define i8* @date_stamp() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i64 @MALLOC(i32 25)
%4 = inttoptr i64 %3 to i8*
%5 = tail call i32 @time(i32* null)
store i32 %5, i32* %1
%6 = call i32 @localtime(i32* %1)
%7 = call i32 @strftime(i8* %4, i32 12, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void err_sys(char *message) {
  fprintf(stderr, "%s\n", message);
  exit(0);
}


x86 assembly (clang, -O0):
<err_sys>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<err_sys>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @err_sys(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @err_sys(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ hd44780_ll_register_read(int);
uint8_t hd44780_ll_data_read(void) { return (hd44780_ll_register_read(1)); }


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

x86 assembly (clang, -O2):
<hd44780_ll_data_read>:
mov    $0x1,%edi
jmp    1030 <hd44780_ll_register_read@plt>

LLVM IR (-O0):
define i32 @hd44780_ll_data_read() {
%1 = call i32 @hd44780_ll_register_read(i32 1)
ret i32 %1
}

LLVM IR (-O2):
define i32 @hd44780_ll_data_read() {
%1 = tail call i32 @hd44780_ll_register_read(i32 1)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, double *);
int main() {
  double celsius, fahrenheit;
  printf("Enter the value in Degrees Fahrenheit >\n");
  scanf("%lf", &fahrenheit);
  celsius = -17.22 * fahrenheit;
  printf("That equals to %.2f Degrees Celsius\n", celsius);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeed(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
movsd  0xeab(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    0xeca(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef9(%rip),%rdi
call   1030 <puts@plt>
lea    0xec4(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
movsd  (%rsp),%xmm0
mulsd  0xea7(%rip),%xmm0
lea    0xeac(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [41 x i8] c"Enter the value in Degrees Fahrenheit >\0A\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [37 x i8] c"That equals to %.2f Degrees Celsius\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%6 = load double, double* %3
%7 = fmul double -1.722000e+01, %6
store double %7, double* %2
%8 = load double, double* %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), double %8)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [37 x i8] c"That equals to %.2f Degrees Celsius\0A\00"
@str = [40 x i8] c"Enter the value in Degrees Fahrenheit >\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%5 = load double, double* %1
%6 = fmul double %5, -1.722000e+01
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), double %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void PlaneStep2(void) { printf("PlaneStep2\n"); }


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

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

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

LLVM IR (-O2):
@str = [11 x i8] c"PlaneStep2\00"
define void @PlaneStep2() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
int CntBits(uint16_t x) {
  int nbits = 0;
  while (x != 0) {
    nbits += x & 1;
    x >>= 1;
  }
  return nbits;
}


x86 assembly (clang, -O0):
<CntBits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1132 <CntBits+0x32>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110e <CntBits+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<CntBits>:
xor    %eax,%eax
test   %edi,%edi
je     1120 <CntBits+0x20>
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
mov    %edi,%edx
and    $0x1,%edx
add    %edx,%eax
sar    %ecx
cmp    $0x1,%edi
mov    %ecx,%edi
ja     1110 <CntBits+0x10>
ret

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

LLVM IR (-O2):
define i32 @CntBits(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %8, %3 ], [ %0, %1 ]
%6 = and i32 %5, 1
%7 = add nuw nsw i32 %4, %6
%8 = ashr i32 %5, 1
%9 = icmp ult i32 %5, 2
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("MBEDTLS_BIGNUM_C and/or MBEDTLS_FS_IO not defined.\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 = [52 x i8] c"MBEDTLS_BIGNUM_C and/or MBEDTLS_FS_IO not defined.\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [51 x i8] c"MBEDTLS_BIGNUM_C and/or MBEDTLS_FS_IO not defined.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
struct timeval {
  int tv_sec;
  unsigned long tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
unsigned long tm_get_time() {
  struct timeval tv;
  gettimeofday(&tv, NULL);
  return 1000000 * tv.tv_sec + tv.tv_usec;
}


x86 assembly (clang, -O0):
<tm_get_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
imul   $0xf4240,-0x10(%rbp),%eax
cltq
add    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tm_get_time>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movslq 0x8(%rsp),%rax
imul   $0xf4240,%rax,%rax
add    0x10(%rsp),%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
define i64 @tm_get_time() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load i32, i32* %3
%5 = mul nsw i32 1000000, %4
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%8 = load i64, i64* %7
%9 = add i64 %6, %8
ret i64 %9
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
define i64 @tm_get_time() {
%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 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000000
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%9 = load i64, i64* %8
%10 = add i64 %9, %7
ret i64 %10
}
/* Variables and functions */
scalar_t__ isdigit(char);
int is_ppc_reg(char *arg) {
  return ((arg[0] == 'r') && ((arg[1] == '(') || isdigit(arg[1])));
}


x86 assembly (clang, -O0):
<is_ppc_reg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x72,%ecx
mov    %al,-0x9(%rbp)
jne    1164 <is_ppc_reg+0x54>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%ecx
mov    $0x1,%al
cmp    $0x28,%ecx
mov    %al,-0xa(%rbp)
je     115e <is_ppc_reg+0x4e>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_ppc_reg>:
push   %rax
xor    %eax,%eax
cmpb   $0x72,(%rdi)
jne    1138 <is_ppc_reg+0x28>
mov    0x1(%rdi),%cl
mov    $0x1,%eax
cmp    $0x28,%cl
je     1138 <is_ppc_reg+0x28>
movsbl %cl,%edi
call   1030 <isdigit@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @is_ppc_reg(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 114
br i1 %3, label %4, label %12
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 40
br i1 %7, label %12, label %8
8: ; preds = %4
%9 = tail call i64 @isdigit(i8 signext %6)
%10 = icmp ne i64 %9, 0
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %4, %8, %1
%13 = phi i32 [ 0, %1 ], [ 1, %4 ], [ %11, %8 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void s_exit(void) {
  printf("GoodBye\n");
  exit(0);
}


x86 assembly (clang, -O0):
<s_exit>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<s_exit>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"GoodBye\0A\00"
define void @s_exit() {
%1 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [8 x i8] c"GoodBye\00"
define void @s_exit() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ wDateTimePush(char, int /*<<< orphan*/);
int /*<<< orphan*/ wStackPopDateTime();
void wBuiltinMinute() { wDateTimePush('m', wStackPopDateTime()); }


x86 assembly (clang, -O0):
<wBuiltinMinute>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <wStackPopDateTime@plt>
mov    %eax,%esi
mov    $0x6d,%edi
call   1030 <wDateTimePush@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<wBuiltinMinute>:
push   %rax
xor    %eax,%eax
call   1040 <wStackPopDateTime@plt>
mov    $0x6d,%edi
mov    %eax,%esi
pop    %rax
jmp    1030 <wDateTimePush@plt>

LLVM IR (-O0):
define void @wBuiltinMinute() {
%1 = call i32 (...) @wStackPopDateTime()
%2 = call i32 @wDateTimePush(i8 signext 109, i32 %1)
ret void
}

LLVM IR (-O2):
define void @wBuiltinMinute() {
%1 = tail call i32 (...) @wStackPopDateTime()
%2 = tail call i32 @wDateTimePush(i8 signext 109, i32 %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ __u8;
typedef int __u32;

/* Variables and functions */
int /*<<< orphan*/ __put_unaligned_2(int, int /*<<< orphan*/ *);
extern void __put_unaligned_4(__u32 __v, register __u8 *__p) {
  __put_unaligned_2(__v, __p + 2);
  __put_unaligned_2(__v >> 16, __p);
}


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

x86 assembly (clang, -O2):
<__put_unaligned_4>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
add    $0x8,%rsi
call   1030 <__put_unaligned_2@plt>
sar    $0x10,%ebp
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <__put_unaligned_2@plt>

LLVM IR (-O0):
define void @__put_unaligned_4(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
%5 = load i32, i32* %3
%6 = load i32*, i32** %4
%7 = getelementptr inbounds i32, i32* %6, i64 2
%8 = call i32 @__put_unaligned_2(i32 %5, i32* %7)
%9 = load i32, i32* %3
%10 = ashr i32 %9, 16
%11 = load i32*, i32** %4
%12 = call i32 @__put_unaligned_2(i32 %10, i32* %11)
ret void
}

LLVM IR (-O2):
define void @__put_unaligned_4(i32 %0, i32* %1) {
%3 = getelementptr inbounds i32, i32* %1, i64 2
%4 = tail call i32 @__put_unaligned_2(i32 %0, i32* %3)
%5 = ashr i32 %0, 16
%6 = tail call i32 @__put_unaligned_2(i32 %5, i32* %1)
ret void
}
/* Variables and functions */
int rand();
unsigned char get_random_char() {
  unsigned char base = ' ';
  unsigned int res = rand() % 27;
  if (res) {
    return 96 + res;
  }
  return base;
}


x86 assembly (clang, -O0):
<get_random_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x20,-0x2(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x1b,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1146 <get_random_char+0x36>
mov    -0x8(%rbp),%eax
add    $0x60,%eax
mov    %al,-0x1(%rbp)
jmp    114c <get_random_char+0x3c>
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_random_char>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x4bda12f7,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,8),%ecx
lea    (%rcx,%rcx,2),%ecx
sub    %ecx,%eax
lea    0x60(%rax),%ecx
test   %eax,%eax
movzbl %cl,%ecx
mov    $0x20,%eax
cmovne %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define zeroext i8 @get_random_char() {
%1 = alloca i8
%2 = alloca i8
%3 = alloca i32
store i8 32, i8* %2
%4 = call i32 (...) @rand()
%5 = srem i32 %4, 27
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %0
%9 = load i32, i32* %3
%10 = add i32 96, %9
%11 = trunc i32 %10 to i8
store i8 %11, i8* %1
br label %14
12: ; preds = %0
%13 = load i8, i8* %2
store i8 %13, i8* %1
br label %14
14: ; preds = %12, %8
%15 = load i8, i8* %1
ret i8 %15
}

LLVM IR (-O2):
define zeroext i8 @get_random_char() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 27
%3 = icmp eq i32 %2, 0
%4 = trunc i32 %2 to i8
%5 = add nsw i8 %4, 96
%6 = select i1 %3, i8 32, i8 %5
ret i8 %6
}
/* Variables and functions */
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int random_int() {
  srand(time(NULL));
  int integer = rand() % 100000;
  return integer;
}


x86 assembly (clang, -O0):
<random_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x186a0,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_int>:
push   %rax
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
xor    %eax,%eax
call   1050 <rand@plt>
cltq
imul   $0x14f8b589,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x2d,%rcx
add    %edx,%ecx
imul   $0x186a0,%ecx,%ecx
sub    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @random_int() {
%1 = alloca i32
%2 = call i32 @time(i32* null)
%3 = call i32 @srand(i32 %2)
%4 = call i32 (...) @rand()
%5 = srem i32 %4, 100000
store i32 %5, i32* %1
%6 = load i32, i32* %1
ret i32 %6
}

LLVM IR (-O2):
define i32 @random_int() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call i32 (...) @rand()
%4 = srem i32 %3, 100000
ret i32 %4
}
void add(int *a, int *b) { *a = *a + *b; }


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

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

LLVM IR (-O0):
define void @add(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %5
%7 = load i32*, i32** %4
%8 = load i32, i32* %7
%9 = add nsw i32 %6, %8
%10 = load i32*, i32** %3
store i32 %9, i32* %10
ret void
}

LLVM IR (-O2):
define void @add(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
%5 = add nsw i32 %4, %3
store i32 %5, i32* %0
ret void
}
int ac_get_wkst() { return 1; }


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

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

LLVM IR (-O0):
define i32 @ac_get_wkst() {
ret i32 1
}

LLVM IR (-O2):
define i32 @ac_get_wkst() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ vprintf(char *);
int main(void) {
  char s[] = "Hello, my darling wife!";
  vprintf(s);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movaps 0xee5(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x21656669772067,%rax
mov    %rax,0x10(%rsp)
mov    %rsp,%rdi
call   1030 <vprintf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.s = [24 x i8] c"Hello, my darling wife!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [24 x i8]
store i32 0, i32* %1
%3 = bitcast [24 x i8]* %2 to i8*
%4 = getelementptr inbounds [24 x i8], [24 x i8]* %2, i64 0, i64 0
%5 = call i32 @vprintf(i8* %4)
ret i32 0
}

LLVM IR (-O2):
@__const.main.s = [24 x i8] c"Hello, my darling wife!\00"
define i32 @main() {
%1 = alloca [24 x i8]
%2 = getelementptr inbounds [24 x i8], [24 x i8]* %1, i64 0, i64 0
%3 = call i32 @vprintf(i8* %2)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ bym(int /*<<< orphan*/);
int /*<<< orphan*/ sub();
void sub_bym(uint32_t x) {
  bym(x);
  sub();
}


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

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

LLVM IR (-O0):
define void @sub_bym(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @bym(i32 %3)
%5 = call i32 (...) @sub()
ret void
}

LLVM IR (-O2):
define void @sub_bym(i32 %0) {
%2 = tail call i32 @bym(i32 %0)
%3 = tail call i32 (...) @sub()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void menu() {
  printf("\nWhat should I eat:\n(press a,b,c,d on your "
         "keyboard)\n\na.People\nb.Eggs\nc.Brains\nd.Don't know\n\nI choose:");
}


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

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

LLVM IR (-O0):
@.str = [103 x i8] c"\0AWhat should I eat:\0A(press a,b,c,d on your keyboard)\0A\0Aa.People\0Ab.Eggs\0Ac.Brains\0Ad.Don't know\0A\0AI choose:\00"
define void @menu() {
%1 = call i32 @printf(i8* getelementptr inbounds ([103 x i8], [103 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [103 x i8] c"\0AWhat should I eat:\0A(press a,b,c,d on your keyboard)\0A\0Aa.People\0Ab.Eggs\0Ac.Brains\0Ad.Don't know\0A\0AI choose:\00"
define void @menu() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([103 x i8], [103 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ lib2_func2();
void lib1_func1(void) { lib2_func2(); }


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

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

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

LLVM IR (-O2):
define void @lib1_func1() {
%1 = tail call i32 (...) @lib2_func2()
ret void
}
void __set_bit(int nr, volatile unsigned long *addr) {
  __asm__ volatile("bts %1,%0"
                   : "+m"(*(volatile long *)(addr))
                   : "Ir"(nr)
                   : "memory");
}


x86 assembly (clang, -O0):
<__set_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
bts    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<__set_bit>:
bts    %edi,(%rsi)
ret

LLVM IR (-O0):
define void @__set_bit(i32 %0, i64* %1) {
%3 = alloca i32
%4 = alloca i64*
store i32 %0, i32* %3
store i64* %1, i64** %4
%5 = load i64*, i64** %4
%6 = load i32, i32* %3
ret void
}

LLVM IR (-O2):
define void @__set_bit(i32 %0, i64* %1) {
tail call void asm sideeffect "bts $1,$0", "=*m,Ir,*m,~{memory},~{dirflag},~{fpsr},~{flags}"(i64* elementtype(i64) %1, i32 %0, i64* elementtype(i64) %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
void ciao_at_exit(int result) {
  fflush(NULL);
  exit(result);
}


x86 assembly (clang, -O0):
<ciao_at_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1030 <fflush@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<ciao_at_exit>:
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
call   1030 <fflush@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @ciao_at_exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @fflush(i32* null)
%4 = load i32, i32* %2
%5 = call i32 @exit(i32 %4)
unreachable
}

LLVM IR (-O2):
define void @ciao_at_exit(i32 %0) {
%2 = tail call i32 @fflush(i32* null)
%3 = tail call i32 @exit(i32 %0)
unreachable
}
__attribute__((visibility("default"))) void clean_IntelHEX(char *file) {}


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

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

LLVM IR (-O0):
define void @clean_IntelHEX(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret void
}

LLVM IR (-O2):
define void @clean_IntelHEX(i8* nocapture %0) {
ret void
}
int ft_str_is_numeric(char *str) {
  int x;
  x = 0;
  while (str[x]) {
    if ((str[x] < 48) || (str[x] > 57))
      return (0);
    x++;
  }
  return (1);
}


x86 assembly (clang, -O0):
<ft_str_is_numeric>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1165 <ft_str_is_numeric+0x65>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x30,%eax
jl     114b <ft_str_is_numeric+0x4b>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x39,%eax
jle    1157 <ft_str_is_numeric+0x57>
movl   $0x0,-0x4(%rbp)
jmp    116c <ft_str_is_numeric+0x6c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    110f <ft_str_is_numeric+0xf>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_str_is_numeric>:
mov    (%rdi),%cl
mov    $0x1,%eax
test   %cl,%cl
je     1123 <ft_str_is_numeric+0x23>
add    $0x1,%rdi
nop
add    $0xc6,%cl
cmp    $0xf5,%cl
jbe    1124 <ft_str_is_numeric+0x24>
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <ft_str_is_numeric+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @ft_str_is_numeric(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %8
4: ; preds = %8
%5 = getelementptr inbounds i8, i8* %0, i64 %13
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %14, label %8
8: ; preds = %1, %4
%9 = phi i64 [ %13, %4 ], [ 0, %1 ]
%10 = phi i8 [ %6, %4 ], [ %2, %1 ]
%11 = add i8 %10, -58
%12 = icmp ult i8 %11, -10
%13 = add nuw i64 %9, 1
br i1 %12, label %14, label %4
14: ; preds = %8, %4, %1
%15 = phi i32 [ 1, %1 ], [ 1, %4 ], [ 0, %8 ]
ret i32 %15
}
void foo147(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo147(i32 %0) {
ret void
}
/* Variables and functions */
int dont_inline(int);
int bar(int b, int c) { return dont_inline(c); }


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

x86 assembly (clang, -O2):
<bar>:
mov    %esi,%edi
jmp    1030 <dont_inline@plt>

LLVM IR (-O0):
define i32 @bar(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = call i32 @dont_inline(i32 %5)
ret i32 %6
}

LLVM IR (-O2):
define i32 @bar(i32 %0, i32 %1) {
%3 = tail call i32 @dont_inline(i32 %1)
ret i32 %3
}
/* Variables and functions */
int rand();
int getRandom(int low, int high) { return rand() % (high + 1 - low) + low; }


x86 assembly (clang, -O0):
<getRandom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
sub    -0x4(%rbp),%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getRandom>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <rand@plt>
sub    %ebp,%ebx
add    $0x1,%ebx
cltd
idiv   %ebx
add    %edx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @getRandom(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 (...) @rand()
%6 = load i32, i32* %4
%7 = add nsw i32 %6, 1
%8 = load i32, i32* %3
%9 = sub nsw i32 %7, %8
%10 = srem i32 %5, %9
%11 = load i32, i32* %3
%12 = add nsw i32 %10, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @getRandom(i32 %0, i32 %1) {
%3 = tail call i32 (...) @rand()
%4 = sub i32 1, %0
%5 = add i32 %4, %1
%6 = srem i32 %3, %5
%7 = add nsw i32 %6, %0
ret i32 %7
}
/* Variables and functions */
double exp(int /*<<< orphan*/);
int /*<<< orphan*/ lgamma(double);
double long_factorial(double n) { return exp(lgamma(n)); }


x86 assembly (clang, -O0):
<long_factorial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <lgamma@plt>
mov    %eax,%edi
call   1030 <exp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<long_factorial>:
push   %rax
call   1040 <lgamma@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <exp@plt>

LLVM IR (-O0):
define double @long_factorial(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @lgamma(double %3)
%5 = call double @exp(i32 %4)
ret double %5
}

LLVM IR (-O2):
define double @long_factorial(double %0) {
%2 = tail call i32 @lgamma(double %0)
%3 = tail call double @exp(i32 %2)
ret double %3
}
unsigned short am335x_get_part_no(void) {
  unsigned int dev_id, part_no;
  dev_id = *(unsigned int *)((0x44E10000) + 0x600);
  part_no = ((dev_id >> 12) & 0xffff);
  return part_no;
}


x86 assembly (clang, -O0):
<am335x_get_part_no>:
push   %rbp
mov    %rsp,%rbp
mov    $0x44e10600,%eax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0xc,%eax
and    $0xffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<am335x_get_part_no>:
mov    0x44e10600,%eax
shr    $0xc,%eax
ret

LLVM IR (-O0):
define zeroext i16 @am335x_get_part_no() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* inttoptr (i64 1155597824 to i32*)
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = lshr i32 %4, 12
%6 = and i32 %5, 65535
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = trunc i32 %7 to i16
ret i16 %8
}

LLVM IR (-O2):
define zeroext i16 @am335x_get_part_no() {
%1 = load i32, i32* inttoptr (i64 1155597824 to i32*)
%2 = lshr i32 %1, 12
%3 = trunc i32 %2 to i16
ret i16 %3
}
float fahrenheit_celsius(fahr) { return (5.0 / 9.0) * (fahr - 32); }


x86 assembly (clang, -O0):
<fahrenheit_celsius>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x20,%eax
cvtsi2sd %eax,%xmm1
movsd  0xee7(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fahrenheit_celsius>:
add    $0xffffffe0,%edi
cvtsi2sd %edi,%xmm0
mulsd  0xef1(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @fahrenheit_celsius(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 %3, 32
%5 = sitofp i32 %4 to double
%6 = fmul double 0x3FE1C71C71C71C72, %5
%7 = fptrunc double %6 to float
ret float %7
}

LLVM IR (-O2):
define float @fahrenheit_celsius(i32 %0) {
%2 = add nsw i32 %0, -32
%3 = sitofp i32 %2 to double
%4 = fmul double %3, 0x3FE1C71C71C71C72
%5 = fptrunc double %4 to float
ret float %5
}
short simpleswab16(short from) {
  return (((from << 8) & 0xFF00) | ((from >> 8) & 0x00FF));
}


x86 assembly (clang, -O0):
<simpleswab16>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
shl    $0x8,%eax
and    $0xff00,%eax
movswl -0x2(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff,%ecx
or     %ecx,%eax
cwtl
pop    %rbp
ret

x86 assembly (clang, -O2):
<simpleswab16>:
mov    %edi,%eax
rol    $0x8,%ax
ret

LLVM IR (-O0):
define signext i16 @simpleswab16(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = shl i32 %4, 8
%6 = and i32 %5, 65280
%7 = load i16, i16* %2
%8 = sext i16 %7 to i32
%9 = ashr i32 %8, 8
%10 = and i32 %9, 255
%11 = or i32 %6, %10
%12 = trunc i32 %11 to i16
ret i16 %12
}

LLVM IR (-O2):
define signext i16 @simpleswab16(i16 signext %0) {
%2 = tail call i16 @llvm.bswap.i16(i16 %0)
ret i16 %2
}
/* Variables and functions */
int /*<<< orphan*/ sw_uartdbg_tc(char);
int /*<<< orphan*/ sw_usleep(int);
int uartdbgtest_output() {
  for (;;) {
    sw_uartdbg_tc('A');
    sw_usleep(100 * 1000);
  }
  return 0;
}


x86 assembly (clang, -O0):
<uartdbgtest_output>:
push   %rbp
mov    %rsp,%rbp
jmp    1129 <uartdbgtest_output+0x9>
mov    $0x41,%edi
call   1030 <sw_uartdbg_tc@plt>
mov    $0x186a0,%edi
call   1040 <sw_usleep@plt>
jmp    1129 <uartdbgtest_output+0x9>

x86 assembly (clang, -O2):
<uartdbgtest_output>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x41,%edi
call   1030 <sw_uartdbg_tc@plt>
mov    $0x186a0,%edi
call   1040 <sw_usleep@plt>
jmp    1130 <uartdbgtest_output+0x10>

LLVM IR (-O0):
define i32 @uartdbgtest_output() {
br label %1
1: ; preds = %1, %0
%2 = call i32 @sw_uartdbg_tc(i8 signext 65)
%3 = call i32 @sw_usleep(i32 100000)
br label %1
}

LLVM IR (-O2):
define i32 @uartdbgtest_output() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @sw_uartdbg_tc(i8 signext 65)
%3 = tail call i32 @sw_usleep(i32 100000)
br label %1
}