xunge/DecIR huggingface dataset:
int c_to_int(const char c) {
  switch (c) {
  case '0':
    return 0;
  case '1':
    return 1;
  case '2':
    return 2;
  case '3':
    return 3;
  case '4':
    return 4;
  case '5':
    return 5;
  case '6':
    return 6;
  case '7':
    return 7;
  case '8':
    return 8;
  case '9':
    return 9;
  default:
    return -1;
  }
}


x86 assembly (clang, -O0):
<c_to_int>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
add    $0xffffffd0,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x9,%eax
ja     11ac <c_to_int+0xac>
mov    -0x10(%rbp),%rax
lea    0xed5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x0,-0x4(%rbp)
jmp    11b3 <c_to_int+0xb3>
movl   $0x1,-0x4(%rbp)
jmp    11b3 <c_to_int+0xb3>
movl   $0x2,-0x4(%rbp)
jmp    11b3 <c_to_int+0xb3>
movl   $0x3,-0x4(%rbp)
jmp    11b3 <c_to_int+0xb3>
movl   $0x4,-0x4(%rbp)
jmp    11b3 <c_to_int+0xb3>
movl   $0x5,-0x4(%rbp)
jmp    11b3 <c_to_int+0xb3>
movl   $0x6,-0x4(%rbp)
jmp    11b3 <c_to_int+0xb3>
movl   $0x7,-0x4(%rbp)
jmp    11b3 <c_to_int+0xb3>
movl   $0x8,-0x4(%rbp)
jmp    11b3 <c_to_int+0xb3>
movl   $0x9,-0x4(%rbp)
jmp    11b3 <c_to_int+0xb3>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_to_int>:
lea    -0x30(%rdi),%ecx
cmp    $0xa,%ecx
mov    $0xffffffff,%eax
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @c_to_int(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %16 [
i32 48, label %6
i32 49, label %7
i32 50, label %8
i32 51, label %9
i32 52, label %10
i32 53, label %11
i32 54, label %12
i32 55, label %13
i32 56, label %14
i32 57, label %15
]
6: ; preds = %1
store i32 0, i32* %2
br label %17
7: ; preds = %1
store i32 1, i32* %2
br label %17
8: ; preds = %1
store i32 2, i32* %2
br label %17
9: ; preds = %1
store i32 3, i32* %2
br label %17
10: ; preds = %1
store i32 4, i32* %2
br label %17
11: ; preds = %1
store i32 5, i32* %2
br label %17
12: ; preds = %1
store i32 6, i32* %2
br label %17
13: ; preds = %1
store i32 7, i32* %2
br label %17
14: ; preds = %1
store i32 8, i32* %2
br label %17
15: ; preds = %1
store i32 9, i32* %2
br label %17
16: ; preds = %1
store i32 -1, i32* %2
br label %17
17: ; preds = %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
define i32 @c_to_int(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add nsw i32 %2, -48
%4 = icmp ult i32 %3, 10
%5 = select i1 %4, i32 %3, i32 -1
ret i32 %5
}
/* Type definitions */
struct servent {
  char const *s_name;
};

/* Variables and functions */
struct servent *getservbyport(int /*<<< orphan*/, char const *);
int /*<<< orphan*/ htons(int);
const char *get_port_service_name(int port, const char *proto) {
  struct servent *serv = getservbyport(htons(port), proto);
  return serv ? serv->s_name : NULL;
}


x86 assembly (clang, -O0):
<get_port_service_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <htons@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
call   1040 <getservbyport@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1161 <get_port_service_name+0x41>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    116c <get_port_service_name+0x4c>
xor    %eax,%eax
mov    %rax,-0x20(%rbp)
jmp    116c <get_port_service_name+0x4c>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_port_service_name>:
push   %rbx
mov    %rsi,%rbx
call   1030 <htons@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1040 <getservbyport@plt>
test   %rax,%rax
je     113d <get_port_service_name+0x1d>
mov    (%rax),%rax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.servent = type { i8* }
define i8* @get_port_service_name(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca %struct.servent*
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i32, i32* %3
%7 = call i32 @htons(i32 %6)
%8 = load i8*, i8** %4
%9 = call %struct.servent* @getservbyport(i32 %7, i8* %8)
store %struct.servent* %9, %struct.servent** %5
%10 = load %struct.servent*, %struct.servent** %5
%11 = icmp ne %struct.servent* %10, null
br i1 %11, label %12, label %16
12: ; preds = %2
%13 = load %struct.servent*, %struct.servent** %5
%14 = getelementptr inbounds %struct.servent, %struct.servent* %13, i32 0, i32 0
%15 = load i8*, i8** %14
br label %17
16: ; preds = %2
br label %17
17: ; preds = %16, %12
%18 = phi i8* [ %15, %12 ], [ null, %16 ]
ret i8* %18
}

LLVM IR (-O2):
%struct.servent = type { i8* }
define i8* @get_port_service_name(i32 %0, i8* %1) {
%3 = tail call i32 @htons(i32 %0)
%4 = tail call %struct.servent* @getservbyport(i32 %3, i8* %1)
%5 = icmp eq %struct.servent* %4, null
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = getelementptr inbounds %struct.servent, %struct.servent* %4, i64 0, i32 0
%8 = load i8*, i8** %7
br label %9
9: ; preds = %2, %6
%10 = phi i8* [ %8, %6 ], [ null, %2 ]
ret i8* %10
}
int my_f() {
  int local;
  return 1;
}


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

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

LLVM IR (-O0):
define i32 @my_f() {
%1 = alloca i32
ret i32 1
}

LLVM IR (-O2):
define i32 @my_f() {
ret i32 1
}
void UARTBreakCtl(unsigned int baseAdd, unsigned int breakState) {
  if (1 == breakState) {
    (*((volatile unsigned int *)(baseAdd + (0xC)))) |= (0x00000040u);
  } else {
    (*((volatile unsigned int *)(baseAdd + (0xC)))) &= ~(0x00000040u);
  }
  return;
}


x86 assembly (clang, -O0):
<UARTBreakCtl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x1,%eax
cmp    -0x8(%rbp),%eax
jne    112c <UARTBreakCtl+0x2c>
mov    -0x4(%rbp),%eax
add    $0xc,%eax
mov    %eax,%eax
mov    (%rax),%ecx
or     $0x40,%ecx
mov    %ecx,(%rax)
jmp    113b <UARTBreakCtl+0x3b>
mov    -0x4(%rbp),%eax
add    $0xc,%eax
mov    %eax,%eax
mov    (%rax),%ecx
and    $0xffffffbf,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTBreakCtl>:
xor    %eax,%eax
cmp    $0x1,%esi
sete   %al
add    $0xc,%edi
mov    (%rdi),%ecx
and    $0xffffffbf,%ecx
shl    $0x6,%eax
or     %ecx,%eax
mov    %eax,(%rdi)
ret

LLVM IR (-O0):
define void @UARTBreakCtl(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 = icmp eq i32 1, %5
br i1 %6, label %7, label %14
7: ; preds = %2
%8 = load i32, i32* %3
%9 = add i32 %8, 12
%10 = zext i32 %9 to i64
%11 = inttoptr i64 %10 to i32*
%12 = load volatile i32, i32* %11
%13 = or i32 %12, 64
store volatile i32 %13, i32* %11
br label %21
14: ; preds = %2
%15 = load i32, i32* %3
%16 = add i32 %15, 12
%17 = zext i32 %16 to i64
%18 = inttoptr i64 %17 to i32*
%19 = load volatile i32, i32* %18
%20 = and i32 %19, -65
store volatile i32 %20, i32* %18
br label %21
21: ; preds = %14, %7
ret void
}

LLVM IR (-O2):
define void @UARTBreakCtl(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 1
%4 = add i32 %0, 12
%5 = zext i32 %4 to i64
%6 = inttoptr i64 %5 to i32*
%7 = load volatile i32, i32* %6
%8 = and i32 %7, -65
%9 = select i1 %3, i32 64, i32 0
%10 = or i32 %8, %9
store volatile i32 %10, i32* %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  printf("Hello world!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed3(%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 = [14 x i8] c"Hello world!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [13 x i8] c"Hello world!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int strcmp(char *, char *);
int cmp(const void *_a, const void *_b) {
  char *a = (char *)_a;
  char *b = (char *)_b;
  return strcmp(a, b);
}


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

x86 assembly (clang, -O2):
<cmp>:
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @cmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
store i8* %7, i8** %5
%8 = load i8*, i8** %4
store i8* %8, i8** %6
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = call i32 @strcmp(i8* %9, i8* %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
unsigned int mdrv_sd_get_capacity(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @mdrv_sd_get_capacity() {
ret i32 0
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t MakeESId(uint8_t cStreamId, uint8_t cStreamSubId) {
  if (((cStreamId & 0xF0) == 0xE0)) {
    return 0xE000 | cStreamSubId;
  } else if (((cStreamId & 0xE0) == 0xC0)) {
    return 0xC000 | cStreamSubId;
  } else
    return (cStreamId << 8) | cStreamSubId;
}


x86 assembly (clang, -O0):
<MakeESId>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    $0xf0,%eax
cmp    $0xe0,%eax
jne    112d <MakeESId+0x2d>
mov    -0xc(%rbp),%eax
or     $0xe000,%eax
mov    %eax,-0x4(%rbp)
jmp    115c <MakeESId+0x5c>
mov    -0x8(%rbp),%eax
and    $0xe0,%eax
cmp    $0xc0,%eax
jne    1150 <MakeESId+0x50>
mov    -0xc(%rbp),%eax
or     $0xc000,%eax
mov    %eax,-0x4(%rbp)
jmp    115c <MakeESId+0x5c>
mov    -0x8(%rbp),%eax
shl    $0x8,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<MakeESId>:
mov    %edi,%eax
and    $0xf0,%eax
mov    %edi,%ecx
and    $0xe0,%ecx
shl    $0x8,%edi
cmp    $0xc0,%ecx
mov    $0xc000,%ecx
cmovne %edi,%ecx
cmp    $0xe0,%eax
mov    $0xe000,%eax
cmovne %ecx,%eax
or     %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @MakeESId(i32 %0, i32 %1) {
%3 = and i32 %0, 240
%4 = icmp eq i32 %3, 224
%5 = and i32 %0, 224
%6 = icmp eq i32 %5, 192
%7 = shl i32 %0, 8
%8 = select i1 %6, i32 49152, i32 %7
%9 = select i1 %4, i32 57344, i32 %8
%10 = or i32 %9, %1
ret i32 %10
}
double Pow(double a, double b) {
  int tmp = (*(1 + (int *)&a));
  int tmp2 = (int)(b * (tmp - 1072632447) + 1072632447);
  double p = 0.0;
  *(1 + (int *)&p) = tmp2;
  return p;
}


x86 assembly (clang, -O0):
<Pow>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x14(%rbp),%eax
sub    $0x3fef127f,%eax
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xecf(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movsd  -0x20(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Pow>:
movq   %xmm0,%rax
shr    $0x20,%rax
add    $0xc010ed81,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  %xmm1,%xmm0
addsd  0xedf(%rip),%xmm0
cvttsd2si %xmm0,%eax
shl    $0x20,%rax
movq   %rax,%xmm0
ret

LLVM IR (-O0):
define double @Pow(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
store double %0, double* %3
store double %1, double* %4
%8 = bitcast double* %3 to i32*
%9 = getelementptr inbounds i32, i32* %8, i64 1
%10 = load i32, i32* %9
store i32 %10, i32* %5
%11 = load double, double* %4
%12 = load i32, i32* %5
%13 = sub nsw i32 %12, 1072632447
%14 = sitofp i32 %13 to double
%15 = call double @llvm.fmuladd.f64(double %11, double %14, double 0x41CFF7893F800000)
%16 = fptosi double %15 to i32
store i32 %16, i32* %6
store double 0.000000e+00, double* %7
%17 = load i32, i32* %6
%18 = bitcast double* %7 to i32*
%19 = getelementptr inbounds i32, i32* %18, i64 1
store i32 %17, i32* %19
%20 = load double, double* %7
ret double %20
}

LLVM IR (-O2):
define double @Pow(double %0, double %1) {
%3 = bitcast double %0 to i64
%4 = lshr i64 %3, 32
%5 = trunc i64 %4 to i32
%6 = add nsw i32 %5, -1072632447
%7 = sitofp i32 %6 to double
%8 = tail call double @llvm.fmuladd.f64(double %1, double %7, double 0x41CFF7893F800000)
%9 = fptosi double %8 to i32
%10 = zext i32 %9 to i64
%11 = shl nuw i64 %10, 32
%12 = bitcast i64 %11 to double
ret double %12
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_usage_rb() {
  printf("Usage: gioctl rb add <lcr> <rab_id> <qos>\n");
  printf("Usage: gioctl rb list <lcr>\n");
}


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

x86 assembly (clang, -O2):
<print_usage_rb>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf06(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [43 x i8] c"Usage: gioctl rb add <lcr> <rab_id> <qos>\0A\00"
@.str.1 = [29 x i8] c"Usage: gioctl rb list <lcr>\0A\00"
define void @print_usage_rb() {
%1 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [42 x i8] c"Usage: gioctl rb add <lcr> <rab_id> <qos>\00"
@str.2 = [28 x i8] c"Usage: gioctl rb list <lcr>\00"
define void @print_usage_rb() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  printf(u8"こんにちは、世界！\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed3(%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 = [29 x i8] c"\E3\81\93\E3\82\93\E3\81\AB\E3\81\A1\E3\81\AF\E3\80\81\E4\B8\96\E7\95\8C\EF\BC\81\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [28 x i8] c"\E3\81\93\E3\82\93\E3\81\AB\E3\81\A1\E3\81\AF\E3\80\81\E4\B8\96\E7\95\8C\EF\BC\81\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int array_count(char **array) {
  int result = 0;
  if (!array)
    return 0;
  while (*array) {
    result++;
    array++;
  }
  return result;
}


x86 assembly (clang, -O0):
<array_count>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1126 <array_count+0x26>
movl   $0x0,-0x4(%rbp)
jmp    1159 <array_count+0x59>
jmp    112b <array_count+0x2b>
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     1153 <array_count+0x53>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    112b <array_count+0x2b>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<array_count>:
xor    %eax,%eax
test   %rdi,%rdi
je     111c <array_count+0x1c>
cmpq   $0x0,(%rdi)
je     111c <array_count+0x1c>
xor    %eax,%eax
nop
cmpq   $0x0,0x8(%rdi,%rax,8)
lea    0x1(%rax),%rax
jne    1110 <array_count+0x10>
ret

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

LLVM IR (-O2):
define i32 @array_count(i8** %0) {
%2 = icmp eq i8** %0, null
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = load i8*, i8** %0
%5 = icmp eq i8* %4, null
br i1 %5, label %13, label %6
6: ; preds = %3, %6
%7 = phi i32 [ %9, %6 ], [ 0, %3 ]
%8 = phi i8** [ %10, %6 ], [ %0, %3 ]
%9 = add nuw nsw i32 %7, 1
%10 = getelementptr inbounds i8*, i8** %8, i64 1
%11 = load i8*, i8** %10
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %6
13: ; preds = %6, %3, %1
%14 = phi i32 [ 0, %1 ], [ 0, %3 ], [ %9, %6 ]
ret i32 %14
}
/* Variables and functions */
char simple_access(char *x) {
  if (NULL == x) {
    return 'a';
  } else {
    return *x;
  }
}


x86 assembly (clang, -O0):
<simple_access>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
jne    111d <simple_access+0x1d>
movb   $0x61,-0x1(%rbp)
jmp    1126 <simple_access+0x26>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<simple_access>:
test   %rdi,%rdi
je     1108 <simple_access+0x8>
mov    (%rdi),%al
ret
mov    $0x61,%al
ret

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

LLVM IR (-O2):
define signext i8 @simple_access(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = load i8, i8* %0
br label %5
5: ; preds = %1, %3
%6 = phi i8 [ %4, %3 ], [ 97, %1 ]
ret i8 %6
}
/* Variables and functions */
unsigned long get_error_values(int /*<<< orphan*/, int /*<<< orphan*/,
                               char const **, int *, char const **, int *);
unsigned long ERR_peek_error_line_data(const char **file, int *line,
                                       const char **data, int *flags) {
  return (get_error_values(0, 0, file, line, data, flags));
}


x86 assembly (clang, -O0):
<ERR_peek_error_line_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%r9
xor    %esi,%esi
mov    %esi,%edi
call   1030 <get_error_values@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ERR_peek_error_line_data>:
mov    %rcx,%r9
mov    %rdx,%r8
mov    %rsi,%rcx
mov    %rdi,%rdx
xor    %edi,%edi
xor    %esi,%esi
jmp    1030 <get_error_values@plt>

LLVM IR (-O0):
define i64 @ERR_peek_error_line_data(i8** %0, i32* %1, i8** %2, i32* %3) {
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i8**
%8 = alloca i32*
store i8** %0, i8*** %5
store i32* %1, i32** %6
store i8** %2, i8*** %7
store i32* %3, i32** %8
%9 = load i8**, i8*** %5
%10 = load i32*, i32** %6
%11 = load i8**, i8*** %7
%12 = load i32*, i32** %8
%13 = call i64 @get_error_values(i32 0, i32 0, i8** %9, i32* %10, i8** %11, i32* %12)
ret i64 %13
}

LLVM IR (-O2):
define i64 @ERR_peek_error_line_data(i8** %0, i32* %1, i8** %2, i32* %3) {
%5 = tail call i64 @get_error_values(i32 0, i32 0, i8** %0, i32* %1, i8** %2, i32* %3)
ret i64 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ DES_cblock;

/* Variables and functions */
int /*<<< orphan*/ RAND_seed(int /*<<< orphan*/ *, int);
void _ossl_096_des_random_seed(DES_cblock *key) {
  RAND_seed(key, sizeof(DES_cblock));
}


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

x86 assembly (clang, -O2):
<_ossl_096_des_random_seed>:
mov    $0x4,%esi
jmp    1030 <RAND_seed@plt>

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

LLVM IR (-O2):
define void @_ossl_096_des_random_seed(i32* %0) {
%2 = tail call i32 @RAND_seed(i32* %0, i32 4)
ret void
}
/* Variables and functions */
scalar_t__ malloc(int);
int *multiply(int a, int b) {
  int *mult = (int *)malloc(sizeof(int));
  *mult = a * b;
  return mult;
}


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

x86 assembly (clang, -O2):
<multiply>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x4,%edi
call   1030 <malloc@plt>
imul   %ebx,%ebp
mov    %ebp,(%rax)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32* @multiply(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = call i64 @malloc(i32 4)
%7 = inttoptr i64 %6 to i32*
store i32* %7, i32** %5
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = mul nsw i32 %8, %9
%11 = load i32*, i32** %5
store i32 %10, i32* %11
%12 = load i32*, i32** %5
ret i32* %12
}

LLVM IR (-O2):
define i32* @multiply(i32 %0, i32 %1) {
%3 = tail call i64 @malloc(i32 4)
%4 = inttoptr i64 %3 to i32*
%5 = mul nsw i32 %1, %0
store i32 %5, i32* %4
ret i32* %4
}
/* Variables and functions */
char *GetEnv(char const *);
char *curl_getenv(const char *v) { return GetEnv(v); }


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

x86 assembly (clang, -O2):
<curl_getenv>:
jmp    1030 <GetEnv@plt>

LLVM IR (-O0):
define i8* @curl_getenv(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @GetEnv(i8* %3)
ret i8* %4
}

LLVM IR (-O2):
define i8* @curl_getenv(i8* %0) {
%2 = tail call i8* @GetEnv(i8* %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ UPnPResponse_ContentDirectory_CreateObject(void *, char *,
                                                              char *);
int /*<<< orphan*/ printf(char *, char *, char *);
void UPnPContentDirectory_CreateObject(void *upnptoken, char *ContainerID,
                                       char *Elements) {
  printf("Invoke: UPnPContentDirectory_CreateObject(%s,%s);\r\n", ContainerID,
         Elements);
  UPnPResponse_ContentDirectory_CreateObject(upnptoken, "Sample String",
                                             "Sample String");
}


x86 assembly (clang, -O0):
<UPnPContentDirectory_CreateObject>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    0xee1(%rip),%rdx
mov    %rdx,%rsi
call   1040 <UPnPResponse_ContentDirectory_CreateObject@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UPnPContentDirectory_CreateObject>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
lea    0xefd(%rip),%rdx
mov    %rbx,%rdi
mov    %rdx,%rsi
pop    %rbx
jmp    1040 <UPnPResponse_ContentDirectory_CreateObject@plt>

LLVM IR (-O0):
@.str = [52 x i8] c"Invoke: UPnPContentDirectory_CreateObject(%s,%s);\0D\0A\00"
@.str.1 = [14 x i8] c"Sample String\00"
define void @UPnPContentDirectory_CreateObject(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %5
%8 = load i8*, i8** %6
%9 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %8)
%10 = load i8*, i8** %4
%11 = call i32 @UPnPResponse_ContentDirectory_CreateObject(i8* %10, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [52 x i8] c"Invoke: UPnPContentDirectory_CreateObject(%s,%s);\0D\0A\00"
@.str.1 = [14 x i8] c"Sample String\00"
define void @UPnPContentDirectory_CreateObject(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2)
%5 = tail call i32 @UPnPResponse_ContentDirectory_CreateObject(i8* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EX_USAGE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void emit_help(void) {
  fprintf(stderr, "Usage: getsockname [-4 | -6] [-s] [-u] host port\n");
  exit(EX_USAGE);
}


x86 assembly (clang, -O0):
<emit_help>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<emit_help>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [50 x i8] c"Usage: getsockname [-4 | -6] [-s] [-u] host port\0A\00"
@EX_USAGE = global i32 0
define void @emit_help() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EX_USAGE
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [50 x i8] c"Usage: getsockname [-4 | -6] [-s] [-u] host port\0A\00"
@EX_USAGE = global i32 0
define void @emit_help() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EX_USAGE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Variables and functions */
double strtod(char const *, int /*<<< orphan*/ *);
int value_to_double(const char *val, double *result) {
  double res = strtod(val, NULL);
  if (res == 0) {
    return 0;
  }
  *result = res;
  return 0;
}


x86 assembly (clang, -O0):
<value_to_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <strtod@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1156 <value_to_double+0x46>
jp     1156 <value_to_double+0x46>
movl   $0x0,-0x4(%rbp)
jmp    116a <value_to_double+0x5a>
movsd  -0x20(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<value_to_double>:
push   %rbx
mov    %rsi,%rbx
xor    %esi,%esi
call   1030 <strtod@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1127 <value_to_double+0x17>
jnp    112b <value_to_double+0x1b>
movsd  %xmm0,(%rbx)
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @value_to_double(i8* %0, double* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca double*
%6 = alloca double
store i8* %0, i8** %4
store double* %1, double** %5
%7 = load i8*, i8** %4
%8 = call double @strtod(i8* %7, i32* null)
store double %8, double* %6
%9 = load double, double* %6
%10 = fcmp oeq double %9, 0.000000e+00
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 0, i32* %3
br label %15
12: ; preds = %2
%13 = load double, double* %6
%14 = load double*, double** %5
store double %13, double* %14
store i32 0, i32* %3
br label %15
15: ; preds = %12, %11
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @value_to_double(i8* nocapture %0, double* nocapture writeonly %1) {
%3 = tail call double @strtod(i8* nocapture %0, i32* null)
%4 = fcmp oeq double %3, 0.000000e+00
br i1 %4, label %6, label %5
5: ; preds = %2
store double %3, double* %1
br label %6
6: ; preds = %2, %5
ret i32 0
}
void ps_mem_fence(void) { __asm__ __volatile__("mfence" ::: "memory"); }


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

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

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

LLVM IR (-O2):
define void @ps_mem_fence() {
tail call void asm sideeffect "mfence", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ c;

/* Variables and functions */
int read(int /*<<< orphan*/, unsigned char *, int);
int nb_getch() {
  int r;
  unsigned char c;
  if ((r = read(0, &c, sizeof(c))) < 0) {
    return r;
  } else {
    return c;
  }
}


x86 assembly (clang, -O0):
<nb_getch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
lea    -0x9(%rbp),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jge    113f <nb_getch+0x2f>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1146 <nb_getch+0x36>
movzbl -0x9(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nb_getch>:
push   %rax
lea    0x7(%rsp),%rsi
xor    %edi,%edi
mov    $0x1,%edx
call   1030 <read@plt>
test   %eax,%eax
movzbl 0x7(%rsp),%ecx
cmovns %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @nb_getch() {
%1 = alloca i8
%2 = call i32 @read(i32 0, i8* %1, i32 1)
%3 = icmp slt i32 %2, 0
%4 = load i8, i8* %1
%5 = zext i8 %4 to i32
%6 = select i1 %3, i32 %2, i32 %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ I2CAL_output_clock(int);
int /*<<< orphan*/ I2CAL_output_data(int);
void SendI2CStart(void) {
  I2CAL_output_data(1);
  I2CAL_output_clock(1);
  I2CAL_output_data(0);
  I2CAL_output_clock(0);
}


x86 assembly (clang, -O0):
<SendI2CStart>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <I2CAL_output_data@plt>
mov    $0x1,%edi
call   1040 <I2CAL_output_clock@plt>
xor    %edi,%edi
call   1030 <I2CAL_output_data@plt>
xor    %edi,%edi
call   1040 <I2CAL_output_clock@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<SendI2CStart>:
push   %rax
mov    $0x1,%edi
call   1030 <I2CAL_output_data@plt>
mov    $0x1,%edi
call   1040 <I2CAL_output_clock@plt>
xor    %edi,%edi
call   1030 <I2CAL_output_data@plt>
xor    %edi,%edi
pop    %rax
jmp    1040 <I2CAL_output_clock@plt>

LLVM IR (-O0):
define void @SendI2CStart() {
%1 = call i32 @I2CAL_output_data(i32 1)
%2 = call i32 @I2CAL_output_clock(i32 1)
%3 = call i32 @I2CAL_output_data(i32 0)
%4 = call i32 @I2CAL_output_clock(i32 0)
ret void
}

LLVM IR (-O2):
define void @SendI2CStart() {
%1 = tail call i32 @I2CAL_output_data(i32 1)
%2 = tail call i32 @I2CAL_output_clock(i32 1)
%3 = tail call i32 @I2CAL_output_data(i32 0)
%4 = tail call i32 @I2CAL_output_clock(i32 0)
ret void
}
/* Variables and functions */
int sqrt(int);
double D6(int n, int m) {
  return ((n + 1) * sqrt(n * n - m * m) / (double)(2 * n + 1));
}


x86 assembly (clang, -O0):
<D6>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
imul   -0x4(%rbp),%edi
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
sub    %eax,%edi
call   1030 <sqrt@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<D6>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0x1(%rbx),%ebp
imul   %edi,%edi
imul   %esi,%esi
sub    %esi,%edi
call   1030 <sqrt@plt>
imul   %ebp,%eax
cvtsi2sd %eax,%xmm0
lea    (%rbx,%rbx,1),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define double @D6(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 = add nsw i32 %5, 1
%7 = load i32, i32* %3
%8 = load i32, i32* %3
%9 = mul nsw i32 %7, %8
%10 = load i32, i32* %4
%11 = load i32, i32* %4
%12 = mul nsw i32 %10, %11
%13 = sub nsw i32 %9, %12
%14 = call i32 @sqrt(i32 %13)
%15 = mul nsw i32 %6, %14
%16 = sitofp i32 %15 to double
%17 = load i32, i32* %3
%18 = mul nsw i32 2, %17
%19 = add nsw i32 %18, 1
%20 = sitofp i32 %19 to double
%21 = fdiv double %16, %20
ret double %21
}

LLVM IR (-O2):
define double @D6(i32 %0, i32 %1) {
%3 = add nsw i32 %0, 1
%4 = mul nsw i32 %0, %0
%5 = mul nsw i32 %1, %1
%6 = sub nsw i32 %4, %5
%7 = tail call i32 @sqrt(i32 %6)
%8 = mul nsw i32 %7, %3
%9 = sitofp i32 %8 to double
%10 = shl nsw i32 %0, 1
%11 = or i32 %10, 1
%12 = sitofp i32 %11 to double
%13 = fdiv double %9, %12
ret double %13
}
int AddAnE(word)
char *word;
{ return ((1 == WordSize(word)) && EndsWithCVC(word)); }


x86 assembly (clang, -O0):
<AddAnE>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <WordSize@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %edx,%ecx
mov    %al,-0x9(%rbp)
jne    115f <AddAnE+0x3f>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1040 <EndsWithCVC@plt>
cmp    $0x0,%eax
setne  %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):
<AddAnE>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <WordSize@plt>
cmp    $0x1,%eax
jne    1146 <AddAnE+0x26>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <EndsWithCVC@plt>
xor    %ebx,%ebx
test   %eax,%eax
setne  %bl
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @AddAnE(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @WordSize to i32 (i8*, ...)*)(i8* %3)
%5 = icmp eq i32 1, %4
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @EndsWithCVC to i32 (i8*, ...)*)(i8* %7)
%9 = icmp ne i32 %8, 0
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ false, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @AddAnE(i8* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @WordSize to i32 (i8*, ...)*)(i8* %0)
%3 = icmp eq i32 %2, 1
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i32 (i8*, ...) bitcast (i32 (...)* @EndsWithCVC to i32 (i8*, ...)*)(i8* %0)
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 0, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void adv1() { printf("\n Divisão por zero! ERRO\n\n"); }


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

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

LLVM IR (-O0):
@.str = [28 x i8] c"\0A Divis\C3\A3o por zero! ERRO\0A\0A\00"
define void @adv1() {
%1 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [27 x i8] c"\0A Divis\C3\A3o por zero! ERRO\0A\00"
define void @adv1() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printstr(char *);
int /*<<< orphan*/ setattr_bold();
int /*<<< orphan*/ setattr_normal();
int /*<<< orphan*/ setcurs(int, int);
void print_vitetris_ver(int x, int y) {
  setcurs(x, y);
  setattr_bold();
  printstr("dank-vitetris "
           "0.57");
  setattr_normal();
}


x86 assembly (clang, -O0):
<print_vitetris_ver>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1060 <setcurs@plt>
mov    $0x0,%al
call   1030 <setattr_bold@plt>
lea    0xe99(%rip),%rdi
call   1050 <printstr@plt>
mov    $0x0,%al
call   1040 <setattr_normal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_vitetris_ver>:
push   %rax
call   1060 <setcurs@plt>
xor    %eax,%eax
call   1030 <setattr_bold@plt>
lea    0xeac(%rip),%rdi
call   1050 <printstr@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <setattr_normal@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"dank-vitetris 0.57\00"
define void @print_vitetris_ver(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 = call i32 @setcurs(i32 %5, i32 %6)
%8 = call i32 (...) @setattr_bold()
%9 = call i32 @printstr(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (...) @setattr_normal()
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"dank-vitetris 0.57\00"
define void @print_vitetris_ver(i32 %0, i32 %1) {
%3 = tail call i32 @setcurs(i32 %0, i32 %1)
%4 = tail call i32 (...) @setattr_bold()
%5 = tail call i32 @printstr(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 (...) @setattr_normal()
ret void
}
extern char *StrNCpy(char *dest, register char *s, long count) {
  register char *d = dest;
  while (count-- > 0 && (*d++ = *s++) != '\0')
    ;
  *d = '\0';
  return dest;
}


x86 assembly (clang, -O0):
<StrNCpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rcx
mov    %rcx,%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x21(%rbp)
jle    1164 <StrNCpy+0x64>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x20(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x20(%rbp)
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1174 <StrNCpy+0x74>
jmp    1179 <StrNCpy+0x79>
jmp    1118 <StrNCpy+0x18>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<StrNCpy>:
mov    %rdi,%rax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
test   %rdx,%rdx
jle    112a <StrNCpy+0x2a>
add    $0xffffffffffffffff,%rdx
movzbl (%rsi,%rcx,1),%edi
mov    %dil,(%rax,%rcx,1)
add    $0x1,%rcx
test   %dil,%dil
jne    1110 <StrNCpy+0x10>
add    %rax,%rcx
movb   $0x0,(%rcx)
ret

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

LLVM IR (-O2):
define i8* @StrNCpy(i8* returned writeonly %0, i8* nocapture %1, i64 %2) {
br label %4
4: ; preds = %9, %3
%5 = phi i8* [ %1, %3 ], [ %11, %9 ]
%6 = phi i64 [ %2, %3 ], [ %10, %9 ]
%7 = phi i8* [ %0, %3 ], [ %13, %9 ]
%8 = icmp sgt i64 %6, 0
br i1 %8, label %9, label %15
9: ; preds = %4
%10 = add nsw i64 %6, -1
%11 = getelementptr inbounds i8, i8* %5, i64 1
%12 = load i8, i8* %5
%13 = getelementptr inbounds i8, i8* %7, i64 1
store i8 %12, i8* %7
%14 = icmp eq i8 %12, 0
br i1 %14, label %15, label %4
15: ; preds = %4, %9
%16 = phi i8* [ %13, %9 ], [ %7, %4 ]
store i8 0, i8* %16
ret i8* %0
}
int lower_number(int n1, int n2) {
  if (n1 > n2) {
    return n2;
  } else {
    return n1;
  }
}


x86 assembly (clang, -O0):
<lower_number>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1121 <lower_number+0x21>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1127 <lower_number+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lower_number>:
mov    %edi,%eax
cmp    %esi,%edi
cmovg  %esi,%eax
ret

LLVM IR (-O0):
define i32 @lower_number(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* %5
%8 = icmp sgt i32 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load i32, i32* %5
store i32 %10, i32* %3
br label %13
11: ; preds = %2
%12 = load i32, i32* %4
store i32 %12, i32* %3
br label %13
13: ; preds = %11, %9
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @lower_number(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %1, i32 %0
ret i32 %4
}
/* Variables and functions */
void *realloc(void *, size_t);
void *my_realloc(void *ptr, size_t size) { return realloc(ptr, size); }


x86 assembly (clang, -O0):
<my_realloc>:
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   1030 <realloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_realloc>:
jmp    1030 <realloc@plt>

LLVM IR (-O0):
define i8* @my_realloc(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 i8* @realloc(i8* %5, i64 %6)
ret i8* %7
}

LLVM IR (-O2):
define noalias i8* @my_realloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
ret i8* %3
}
void secp256k1_int_cmov(int *r, const int *a, int flag) {
  unsigned int mask0, mask1, r_masked, a_masked;
  volatile int vflag = flag;
  do {
    (void)(*r >= 0 && *a >= 0);
  } while (0);
  mask0 = (unsigned int)vflag + ~0u;
  mask1 = ~mask0;
  r_masked = ((unsigned int)*r & mask0);
  a_masked = ((unsigned int)*a & mask1);
  *r = (int)(r_masked | a_masked);
}


x86 assembly (clang, -O0):
<secp256k1_int_cmov>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rcx
xor    %eax,%eax
cmpl   $0x0,(%rcx)
mov    %al,-0x29(%rbp)
jl     1134 <secp256k1_int_cmov+0x34>
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
setge  %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
and    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
and    -0x1c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%ecx
or     -0x24(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<secp256k1_int_cmov>:
mov    %edx,-0x4(%rsp)
mov    -0x4(%rsp),%eax
lea    -0x1(%rax),%ecx
neg    %eax
and    (%rdi),%ecx
and    (%rsi),%eax
or     %ecx,%eax
mov    %eax,(%rdi)
ret

LLVM IR (-O0):
define void @secp256k1_int_cmov(i32* %0, i32* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%12 = load i32, i32* %6
store volatile i32 %12, i32* %11
br label %13
13: ; preds = %3
%14 = load i32*, i32** %4
%15 = load i32, i32* %14
%16 = icmp sge i32 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %13
%18 = load i32*, i32** %5
%19 = load i32, i32* %18
%20 = icmp sge i32 %19, 0
br label %21
21: ; preds = %17, %13
%22 = phi i1 [ false, %13 ], [ %20, %17 ]
%23 = zext i1 %22 to i32
br label %24
24: ; preds = %21
%25 = load volatile i32, i32* %11
%26 = add i32 %25, -1
store i32 %26, i32* %7
%27 = load i32, i32* %7
%28 = xor i32 %27, -1
store i32 %28, i32* %8
%29 = load i32*, i32** %4
%30 = load i32, i32* %29
%31 = load i32, i32* %7
%32 = and i32 %30, %31
store i32 %32, i32* %9
%33 = load i32*, i32** %5
%34 = load i32, i32* %33
%35 = load i32, i32* %8
%36 = and i32 %34, %35
store i32 %36, i32* %10
%37 = load i32, i32* %9
%38 = load i32, i32* %10
%39 = or i32 %37, %38
%40 = load i32*, i32** %4
store i32 %39, i32* %40
ret void
}

LLVM IR (-O2):
define void @secp256k1_int_cmov(i32* nocapture %0, i32* nocapture %1, i32 %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
store volatile i32 %2, i32* %4
%6 = load i32, i32* %0
%7 = load volatile i32, i32* %4
%8 = add i32 %7, -1
%9 = sub i32 0, %7
%10 = and i32 %8, %6
%11 = load i32, i32* %1
%12 = and i32 %11, %9
%13 = or i32 %10, %12
store i32 %13, i32* %0
ret void
}