xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  scalar_t__ tm_sec;
  scalar_t__ tm_min;
  scalar_t__ tm_hour;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ mktime(struct tm *);
time_t get_date(time_t input) {
  time_t ti = input;
  struct tm loctm = *localtime(&ti);
  loctm.tm_hour = loctm.tm_min = loctm.tm_sec = 0;
  return mktime(&loctm);
}


x86 assembly (clang, -O0):
<get_date>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
call   1030 <localtime@plt>
mov    (%rax),%rcx
mov    %rcx,-0x20(%rbp)
mov    0x8(%rax),%rcx
mov    %rcx,-0x18(%rbp)
mov    0x10(%rax),%rax
mov    %rax,-0x10(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
call   1040 <mktime@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_date>:
sub    $0x28,%rsp
mov    %edi,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x20(%rsp)
lea    0x10(%rsp),%rdi
call   1040 <mktime@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
%struct.tm = type { i64, i64, i64 }
define i32 @get_date(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.tm
store i32 %0, i32* %2
%5 = load i32, i32* %2
store i32 %5, i32* %3
%6 = call %struct.tm* @localtime(i32* %3)
%7 = bitcast %struct.tm* %4 to i8*
%8 = bitcast %struct.tm* %6 to i8*
%9 = getelementptr inbounds %struct.tm, %struct.tm* %4, i32 0, i32 0
store i64 0, i64* %9
%10 = getelementptr inbounds %struct.tm, %struct.tm* %4, i32 0, i32 1
store i64 0, i64* %10
%11 = getelementptr inbounds %struct.tm, %struct.tm* %4, i32 0, i32 2
store i64 0, i64* %11
%12 = call i32 @mktime(%struct.tm* %4)
ret i32 %12
}

LLVM IR (-O2):
%struct.tm = type { i64, i64, i64 }
define i32 @get_date(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.tm
%4 = bitcast i32* %2 to i8*
store i32 %0, i32* %2
%5 = bitcast %struct.tm* %3 to i8*
%6 = call %struct.tm* @localtime(i32* %2)
%7 = bitcast %struct.tm* %3 to i8*
%8 = call i32 @mktime(%struct.tm* %3)
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ putSock1(char const);
void putSockN(const char *cp, int n) {
  for (; n > 0; n--, cp++)
    putSock1(*cp);
}


x86 assembly (clang, -O0):
<putSockN>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    114f <putSockN+0x3f>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <putSock1@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111f <putSockN+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putSockN>:
push   %rbp
push   %rbx
push   %rax
test   %esi,%esi
jle    1134 <putSockN+0x24>
mov    %esi,%ebp
mov    %rdi,%rbx
add    $0x1,%ebp
nop
movsbl (%rbx),%edi
call   1030 <putSock1@plt>
add    $0x1,%rbx
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
ja     1120 <putSockN+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @putSockN(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
br label %5
5: ; preds = %12, %2
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %17
8: ; preds = %5
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
%11 = call i32 @putSock1(i8 signext %10)
br label %12
12: ; preds = %8
%13 = load i32, i32* %4
%14 = add nsw i32 %13, -1
store i32 %14, i32* %4
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %3
br label %5
17: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @putSockN(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %12
4: ; preds = %2, %4
%5 = phi i32 [ %9, %4 ], [ %1, %2 ]
%6 = phi i8* [ %10, %4 ], [ %0, %2 ]
%7 = load i8, i8* %6
%8 = tail call i32 @putSock1(i8 signext %7)
%9 = add nsw i32 %5, -1
%10 = getelementptr inbounds i8, i8* %6, i64 1
%11 = icmp ugt i32 %5, 1
br i1 %11, label %4, label %12
12: ; preds = %4, %2
ret void
}
int mlx5dr_rule_destroy(struct mlx5dr_rule *rule) { return 0; }


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

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

LLVM IR (-O0):
%struct.mlx5dr_rule = type opaque
define i32 @mlx5dr_rule_destroy(%struct.mlx5dr_rule* %0) {
%2 = alloca %struct.mlx5dr_rule*
store %struct.mlx5dr_rule* %0, %struct.mlx5dr_rule** %2
ret i32 0
}

LLVM IR (-O2):
%struct.mlx5dr_rule = type opaque
define i32 @mlx5dr_rule_destroy(%struct.mlx5dr_rule* nocapture readnone %0) {
ret i32 0
}
float froundup(float input) {
  float fraction, output = 0.0;
  fraction = input - (int)input;
  if (fraction > 0.01) {
    output = (input - fraction) + 1.0;
  } else {
    output = input;
  }
  return output;
}


x86 assembly (clang, -O0):
<froundup>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
cvttss2si -0x4(%rbp),%eax
cvtsi2ss %eax,%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xec7(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    116b <froundup+0x6b>
movss  -0x4(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeaf(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1175 <froundup+0x75>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<froundup>:
cvttps2dq %xmm0,%xmm1
cvtdq2ps %xmm1,%xmm2
movaps %xmm0,%xmm1
subss  %xmm2,%xmm1
xorps  %xmm2,%xmm2
cvtss2sd %xmm1,%xmm2
ucomisd 0xee3(%rip),%xmm2
jbe    112b <froundup+0x2b>
subss  %xmm1,%xmm0
addss  0xedd(%rip),%xmm0
ret

LLVM IR (-O0):
define float @froundup(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
store float %0, float* %2
store float 0.000000e+00, float* %4
%5 = load float, float* %2
%6 = load float, float* %2
%7 = fptosi float %6 to i32
%8 = sitofp i32 %7 to float
%9 = fsub float %5, %8
store float %9, float* %3
%10 = load float, float* %3
%11 = fpext float %10 to double
%12 = fcmp ogt double %11, 1.000000e-02
br i1 %12, label %13, label %20
13: ; preds = %1
%14 = load float, float* %2
%15 = load float, float* %3
%16 = fsub float %14, %15
%17 = fpext float %16 to double
%18 = fadd double %17, 1.000000e+00
%19 = fptrunc double %18 to float
store float %19, float* %4
br label %22
20: ; preds = %1
%21 = load float, float* %2
store float %21, float* %4
br label %22
22: ; preds = %20, %13
%23 = load float, float* %4
ret float %23
}

LLVM IR (-O2):
define float @froundup(float %0) {
%2 = fptosi float %0 to i32
%3 = sitofp i32 %2 to float
%4 = fsub float %0, %3
%5 = fpext float %4 to double
%6 = fcmp ogt double %5, 1.000000e-02
%7 = fsub float %0, %4
%8 = fadd float %7, 1.000000e+00
%9 = select i1 %6, float %8, float %0
ret float %9
}
long long f1(long long a, long long b) {
  a = (a & ~(long long)(0xfffu << 24)) |
      ((b << 24) & (long long)(0xfffu << 24));
  return a;
}


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movabs $0xffffffff00ffffff,%rax
ff ff ff
and    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
shl    $0x18,%rcx
movabs $0xff000000,%rdx
and    %rdx,%rcx
or     %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
movabs $0xffffffff00ffffff,%rax
ff ff ff
and    %rdi,%rax
shl    $0x18,%esi
or     %rsi,%rax
ret

LLVM IR (-O0):
define i64 @f1(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = and i64 %5, -4278190081
%7 = load i64, i64* %4
%8 = shl i64 %7, 24
%9 = and i64 %8, 4278190080
%10 = or i64 %6, %9
store i64 %10, i64* %3
%11 = load i64, i64* %3
ret i64 %11
}

LLVM IR (-O2):
define i64 @f1(i64 %0, i64 %1) {
%3 = and i64 %0, -4278190081
%4 = shl i64 %1, 24
%5 = and i64 %4, 4278190080
%6 = or i64 %5, %3
ret i64 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int writerec(int /*<<< orphan*/ *, char *, int);
int write_endmod(FILE *fp) {
  char endmod[2] = {06, 0};
  return writerec(fp, endmod, 2);
}


x86 assembly (clang, -O0):
<write_endmod>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0xedd(%rip),%ax
mov    %ax,-0xa(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xa(%rbp),%rsi
mov    $0x2,%edx
call   1030 <writerec@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_endmod>:
push   %rax
movw   $0x6,0x6(%rsp)
lea    0x6(%rsp),%rsi
mov    $0x2,%edx
call   1030 <writerec@plt>
pop    %rcx
ret

LLVM IR (-O0):
@__const.write_endmod.endmod = [2 x i8] c"\06\00"
define i32 @write_endmod(i32* %0) {
%2 = alloca i32*
%3 = alloca [2 x i8]
store i32* %0, i32** %2
%4 = bitcast [2 x i8]* %3 to i8*
%5 = load i32*, i32** %2
%6 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%7 = call i32 @writerec(i32* %5, i8* %6, i32 2)
ret i32 %7
}

LLVM IR (-O2):
define i32 @write_endmod(i32* %0) {
%2 = alloca i16
%3 = bitcast i16* %2 to i8*
store i16 6, i16* %2
%4 = call i32 @writerec(i32* %0, i8* %3, i32 2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ gpmc_setup();
int /*<<< orphan*/ printf(char *);
int main() {
  gpmc_setup();
  printf("GPMC configured\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <gpmc_setup@plt>
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [17 x i8] c"GPMC configured\0A\00"
define i32 @main() {
%1 = call i32 (...) @gpmc_setup()
%2 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [16 x i8] c"GPMC configured\00"
define i32 @main() {
%1 = tail call i32 (...) @gpmc_setup()
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
ret i32 0
}
void at91_sys_write(unsigned int reg_offset, unsigned long value) {
  void *addr = (void *)0xffffe200;
  (*(volatile unsigned int *)(addr + reg_offset)) = (value);
  ;
}


x86 assembly (clang, -O0):
<at91_sys_write>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0xffffe200,%eax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,%edx
mov    -0x18(%rbp),%rax
mov    -0x4(%rbp),%ecx
mov    %edx,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<at91_sys_write>:
mov    %edi,%eax
mov    $0xffffe200,%ecx
mov    %esi,(%rax,%rcx,1)
ret

LLVM IR (-O0):
define void @at91_sys_write(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca i8*
store i32 %0, i32* %3
store i64 %1, i64* %4
store i8* inttoptr (i64 4294959616 to i8*), i8** %5
%6 = load i64, i64* %4
%7 = trunc i64 %6 to i32
%8 = load i8*, i8** %5
%9 = load i32, i32* %3
%10 = zext i32 %9 to i64
%11 = getelementptr i8, i8* %8, i64 %10
%12 = bitcast i8* %11 to i32*
store volatile i32 %7, i32* %12
ret void
}

LLVM IR (-O2):
define void @at91_sys_write(i32 %0, i64 %1) {
%3 = trunc i64 %1 to i32
%4 = zext i32 %0 to i64
%5 = getelementptr i8, i8* inttoptr (i64 4294959616 to i8*), i64 %4
%6 = bitcast i8* %5 to i32*
store volatile i32 %3, i32* %6
ret void
}
void addxy(void) {
  extern int x, y, z;
  z = x + y;
}


x86 assembly (clang, -O0):
<addxy>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%ecx
mov    0x2ed4(%rip),%rax
add    (%rax),%ecx
mov    0x2eb3(%rip),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<addxy>:
mov    0x2ed1(%rip),%rax
mov    0x2eda(%rip),%rcx
mov    (%rcx),%ecx
add    (%rax),%ecx
mov    0x2eb7(%rip),%rax
mov    %ecx,(%rax)
ret

LLVM IR (-O0):
@x = external global i32
@y = external global i32
@z = external global i32
define void @addxy() {
%1 = load i32, i32* @x
%2 = load i32, i32* @y
%3 = add nsw i32 %1, %2
store i32 %3, i32* @z
ret void
}

LLVM IR (-O2):
@x = external global i32
@y = external global i32
@z = external global i32
define void @addxy() {
%1 = load i32, i32* @x
%2 = load i32, i32* @y
%3 = add nsw i32 %2, %1
store i32 %3, i32* @z
ret void
}
/* Variables and functions */
int /*<<< orphan*/ drawgrid();
int /*<<< orphan*/ glutSwapBuffers();
void display() {
  drawgrid();
  glutSwapBuffers();
}


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

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

LLVM IR (-O0):
define void @display() {
%1 = call i32 (...) @drawgrid()
%2 = call i32 (...) @glutSwapBuffers()
ret void
}

LLVM IR (-O2):
define void @display() {
%1 = tail call i32 (...) @drawgrid()
%2 = tail call i32 (...) @glutSwapBuffers()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ uart_putc(char);
void bcd_to_ascii(char value) {
  char low = (value & 0xF) + 0x30;
  char high = (value & 0xF0) + 0x30;
  uart_putc(high);
  uart_putc(low);
  return;
}


x86 assembly (clang, -O0):
<bcd_to_ascii>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
and    $0xf,%eax
add    $0x30,%eax
mov    %al,-0x2(%rbp)
movsbl -0x1(%rbp),%eax
and    $0xf0,%eax
add    $0x30,%eax
mov    %al,-0x3(%rbp)
movsbl -0x3(%rbp),%edi
call   1030 <uart_putc@plt>
movsbl -0x2(%rbp),%edi
call   1030 <uart_putc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bcd_to_ascii>:
push   %rbx
mov    %edi,%ebx
and    $0xf,%bl
or     $0x30,%bl
add    $0x30,%dil
and    $0xf0,%dil
movsbl %dil,%edi
call   1030 <uart_putc@plt>
movzbl %bl,%edi
pop    %rbx
jmp    1030 <uart_putc@plt>

LLVM IR (-O0):
define void @bcd_to_ascii(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %2
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = and i32 %6, 15
%8 = add nsw i32 %7, 48
%9 = trunc i32 %8 to i8
store i8 %9, i8* %3
%10 = load i8, i8* %2
%11 = sext i8 %10 to i32
%12 = and i32 %11, 240
%13 = add nsw i32 %12, 48
%14 = trunc i32 %13 to i8
store i8 %14, i8* %4
%15 = load i8, i8* %4
%16 = call i32 @uart_putc(i8 signext %15)
%17 = load i8, i8* %3
%18 = call i32 @uart_putc(i8 signext %17)
ret void
}

LLVM IR (-O2):
define void @bcd_to_ascii(i8 signext %0) {
%2 = and i8 %0, 15
%3 = or i8 %2, 48
%4 = add i8 %0, 48
%5 = and i8 %4, -16
%6 = tail call i32 @uart_putc(i8 signext %5)
%7 = tail call i32 @uart_putc(i8 signext %3)
ret void
}
int fs_http_stat(const char *url, struct stat *buf) { return 0; }


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

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

LLVM IR (-O0):
%struct.stat = type opaque
define i32 @fs_http_stat(i8* %0, %struct.stat* %1) {
%3 = alloca i8*
%4 = alloca %struct.stat*
store i8* %0, i8** %3
store %struct.stat* %1, %struct.stat** %4
ret i32 0
}

LLVM IR (-O2):
%struct.stat = type opaque
define i32 @fs_http_stat(i8* nocapture readnone %0, %struct.stat* nocapture readnone %1) {
ret i32 0
}
void Dump(filename) char *filename;
{}


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

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

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

LLVM IR (-O2):
define void @Dump(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char, char, unsigned int, unsigned int);
int main() {
  char a = 0x80;
  unsigned int b = (unsigned int)a;
  printf("a %x, %d, b %x, %ud\n", a, a, b, b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x80,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x5(%rbp),%dl
mov    -0x5(%rbp),%al
mov    -0xc(%rbp),%ecx
mov    -0xc(%rbp),%r8d
lea    0xec2(%rip),%rdi
movsbl %dl,%esi
movsbl %al,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [21 x i8] c"a %x, %d, b %x, %ud\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
store i32 0, i32* %1
store i8 -128, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
store i32 %5, i32* %3
%6 = load i8, i8* %2
%7 = load i8, i8* %2
%8 = load i32, i32* %3
%9 = load i32, i32* %3
%10 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8 signext %6, i8 signext %7, i32 %8, i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"a %x, %d, b %x, %ud\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8 signext -128, i8 signext -128, i32 -128, i32 -128)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ handle_SAK(int /*<<< orphan*/);
int gen_SAK() { handle_SAK(0); }


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

x86 assembly (clang, -O2):
<gen_SAK>:
xor    %edi,%edi
jmp    1030 <handle_SAK@plt>

LLVM IR (-O0):
define i32 @gen_SAK() {
%1 = alloca i32
%2 = call i32 @handle_SAK(i32 0)
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @gen_SAK() {
%1 = tail call i32 @handle_SAK(i32 0)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  printf("That was easy!\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 = [16 x i8] c"That was easy!\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 ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [15 x i8] c"That was easy!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ thread_exit();
void exit(int status) { thread_exit(); }


x86 assembly (clang, -O0):
<exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <thread_exit@plt>

x86 assembly (clang, -O2):
<exit>:
push   %rax
xor    %eax,%eax
call   1030 <thread_exit@plt>

LLVM IR (-O0):
define void @exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @thread_exit()
unreachable
}

LLVM IR (-O2):
define void @exit(i32 %0) {
%2 = tail call i32 (...) @thread_exit()
unreachable
}
int test_imm_F1uint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0xF1 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_F1uint64_midword_reg>:
test   $0xf10000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_F1uint64_midword_reg(i64 %0) {
%2 = and i64 %0, 15794176
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void child_sub_function(void) {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<child_sub_function>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <child_sub_function+0x9>
jmp    1109 <child_sub_function+0x9>

x86 assembly (clang, -O2):
<child_sub_function>:
jmp    1100 <child_sub_function>

LLVM IR (-O0):
define void @child_sub_function() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @child_sub_function() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  fprintf(stderr, "Usage: sudo ./icmp_server > <filename>]\n");
  exit(EXIT_SUCCESS);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [41 x i8] c"Usage: sudo ./icmp_server > <filename>]\0A\00"
@EXIT_SUCCESS = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_SUCCESS
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [41 x i8] c"Usage: sudo ./icmp_server > <filename>]\0A\00"
@EXIT_SUCCESS = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_SUCCESS
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Variables and functions */
unsigned int constant_time_msb(unsigned int);
unsigned int constant_time_is_zero(unsigned int a) {
  return constant_time_msb(~a & (a - 1));
}


x86 assembly (clang, -O0):
<constant_time_is_zero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
xor    $0xffffffff,%edi
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
and    %eax,%edi
call   1030 <constant_time_msb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<constant_time_is_zero>:
mov    %edi,%eax
not    %eax
add    $0xffffffff,%edi
and    %eax,%edi
jmp    1030 <constant_time_msb@plt>

LLVM IR (-O0):
define i32 @constant_time_is_zero(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = xor i32 %3, -1
%5 = load i32, i32* %2
%6 = sub i32 %5, 1
%7 = and i32 %4, %6
%8 = call i32 @constant_time_msb(i32 %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @constant_time_is_zero(i32 %0) {
%2 = xor i32 %0, -1
%3 = add i32 %0, -1
%4 = and i32 %3, %2
%5 = tail call i32 @constant_time_msb(i32 %4)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ Exit(int /*<<< orphan*/);
void QuitStoppedCommand(void) { Exit(0); }


x86 assembly (clang, -O0):
<QuitStoppedCommand>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <Exit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<QuitStoppedCommand>:
xor    %edi,%edi
jmp    1030 <Exit@plt>

LLVM IR (-O0):
define void @QuitStoppedCommand() {
%1 = call i32 @Exit(i32 0)
ret void
}

LLVM IR (-O2):
define void @QuitStoppedCommand() {
%1 = tail call i32 @Exit(i32 0)
ret void
}
int ascending(int a, int b) { return a - b; }


x86 assembly (clang, -O0):
<ascending>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ascending>:
mov    %edi,%eax
sub    %esi,%eax
ret

LLVM IR (-O0):
define i32 @ascending(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 = sub nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @ascending(i32 %0, i32 %1) {
%3 = sub nsw i32 %0, %1
ret i32 %3
}
int samba_get_version(char *version, int len) { return -1; }


x86 assembly (clang, -O0):
<samba_get_version>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @samba_get_version(i8* nocapture readnone %0, i32 %1) {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ blinkdash();
int /*<<< orphan*/ sleep(double);
int blinkO() {
  int c = 0;
  while (c != 3) {
    blinkdash();
    c++;
  }
  sleep(1.5);
  return 0;
}


x86 assembly (clang, -O0):
<blinkO>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x3,-0x4(%rbp)
je     114e <blinkO+0x2e>
mov    $0x0,%al
call   1030 <blinkdash@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    112f <blinkO+0xf>
movsd  0xeaa(%rip),%xmm0
call   1040 <sleep@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blinkO>:
push   %rax
xor    %eax,%eax
call   1030 <blinkdash@plt>
xor    %eax,%eax
call   1030 <blinkdash@plt>
xor    %eax,%eax
call   1030 <blinkdash@plt>
movsd  0xec2(%rip),%xmm0
call   1040 <sleep@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @blinkO() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %5, %0
%3 = load i32, i32* %1
%4 = icmp ne i32 %3, 3
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = call i32 (...) @blinkdash()
%7 = load i32, i32* %1
%8 = add nsw i32 %7, 1
store i32 %8, i32* %1
br label %2
9: ; preds = %2
%10 = call i32 @sleep(double 1.500000e+00)
ret i32 0
}

LLVM IR (-O2):
define i32 @blinkO() {
%1 = tail call i32 (...) @blinkdash()
%2 = tail call i32 (...) @blinkdash()
%3 = tail call i32 (...) @blinkdash()
%4 = tail call i32 @sleep(double 1.500000e+00)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_help(void) {
  printf(
      "GNU MAC Changer\n"
      "Usage: macchanger [options] device\n\n"
      "  -h,  --help                   Print this help\n"
      "  -V,  --version                Print version and exit\n"
      "  -s,  --show                   Print the MAC address and exit\n"
      "  -e,  --endding                Don't change the vendor bytes\n"
      "  -a,  --another                Set random vendor MAC of the same kind\n"
      "  -A                            Set random vendor MAC of any kind\n"
      "  -p,  --permanent              Reset to original, permanent hardware "
      "MAC\n"
      "  -r,  --random                 Set fully random MAC\n"
      "  -l,  --list[=keyword]         Print known vendors\n"
      "  -m,  --mac=XX:XX:XX:XX:XX:XX  Set the MAC XX:XX:XX:XX:XX:XX\n\n"
      "Report bugs to alvaro@gnu.org\n");
}


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

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

LLVM IR (-O0):
@.str = [690 x i8] c"GNU MAC Changer\0AUsage: macchanger [options] device\0A\0A -h, --help Print this help\0A -V, --version Print version and exit\0A -s, --show Print the MAC address and exit\0A -e, --endding Don't change the vendor bytes\0A -a, --another Set random vendor MAC of the same kind\0A -A Set random vendor MAC of any kind\0A -p, --permanent Reset to original, permanent hardware MAC\0A -r, --random Set fully random MAC\0A -l, --list[=keyword] Print known vendors\0A -m, --mac=XX:XX:XX:XX:XX:XX Set the MAC XX:XX:XX:XX:XX:XX\0A\0AReport bugs to alvaro@gnu.org\0A\00"
define void @print_help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([690 x i8], [690 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [689 x i8] c"GNU MAC Changer\0AUsage: macchanger [options] device\0A\0A -h, --help Print this help\0A -V, --version Print version and exit\0A -s, --show Print the MAC address and exit\0A -e, --endding Don't change the vendor bytes\0A -a, --another Set random vendor MAC of the same kind\0A -A Set random vendor MAC of any kind\0A -p, --permanent Reset to original, permanent hardware MAC\0A -r, --random Set fully random MAC\0A -l, --list[=keyword] Print known vendors\0A -m, --mac=XX:XX:XX:XX:XX:XX Set the MAC XX:XX:XX:XX:XX:XX\0A\0AReport bugs to alvaro@gnu.org\00"
define void @print_help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([689 x i8], [689 x i8]* @str, i64 0, i64 0))
ret void
}
double Mod(double a, double b) { return a - (long long)a / (long long)b * b; }


x86 assembly (clang, -O0):
<Mod>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm1
cvttsd2si -0x8(%rbp),%rax
cvttsd2si -0x10(%rbp),%rcx
cqto
idiv   %rcx
cvtsi2sd %rax,%xmm0
movsd  -0x10(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Mod>:
cvttsd2si %xmm0,%rax
cvttsd2si %xmm1,%rcx
mov    %rax,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
je     111d <Mod+0x1d>
cqto
idiv   %rcx
jmp    1121 <Mod+0x21>
xor    %edx,%edx
div    %ecx
cvtsi2sd %rax,%xmm2
mulsd  %xmm1,%xmm2
subsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @Mod(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %3
%7 = fptosi double %6 to i64
%8 = load double, double* %4
%9 = fptosi double %8 to i64
%10 = sdiv i64 %7, %9
%11 = sitofp i64 %10 to double
%12 = load double, double* %4
%13 = fneg double %11
%14 = call double @llvm.fmuladd.f64(double %13, double %12, double %5)
ret double %14
}

LLVM IR (-O2):
define double @Mod(double %0, double %1) {
%3 = fptosi double %0 to i64
%4 = fptosi double %1 to i64
%5 = sdiv i64 %3, %4
%6 = sitofp i64 %5 to double
%7 = fneg double %6
%8 = tail call double @llvm.fmuladd.f64(double %7, double %1, double %0)
ret double %8
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void *calloc(size_t, size_t);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void *__xcalloc(size_t nmemb, size_t size, char *at) {
  void *ptr;
  ptr = calloc(nmemb, size);
  if (!ptr) {
    fprintf(stderr, "%s: out of memory", at);
    abort();
  }
  return ptr;
}


x86 assembly (clang, -O0):
<__xcalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <calloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1180 <__xcalloc+0x50>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xe8c(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__xcalloc>:
push   %rbx
mov    %rdx,%rbx
call   1040 <calloc@plt>
test   %rax,%rax
je     1140 <__xcalloc+0x10>
pop    %rbx
ret
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rsi
mov    %rbx,%rdx
call   1050 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [18 x i8] c"%s: out of memory\00"
define i8* @__xcalloc(i64 %0, i64 %1, i8* %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i8*
%7 = alloca i8*
store i64 %0, i64* %4
store i64 %1, i64* %5
store i8* %2, i8** %6
%8 = load i64, i64* %4
%9 = load i64, i64* %5
%10 = call i8* @calloc(i64 %8, i64 %9)
store i8* %10, i8** %7
%11 = load i8*, i8** %7
%12 = icmp ne i8* %11, null
br i1 %12, label %18, label %13
13: ; preds = %3
%14 = load i32, i32* @stderr
%15 = load i8*, i8** %6
%16 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = call i32 (...) @abort()
unreachable
18: ; preds = %3
%19 = load i8*, i8** %7
ret i8* %19
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [18 x i8] c"%s: out of memory\00"
define noalias i8* @__xcalloc(i64 %0, i64 %1, i8* %2) {
%4 = tail call i8* @calloc(i64 %0, i64 %1)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %2)
%9 = tail call i32 (...) @abort()
unreachable
10: ; preds = %3
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void print_help() {
  puts(
      "Ed - The line editor.\nUsage: ed [options] [file]\n\nOptions:\n  -h, "
      "--help                 display this help and exit\n  -V, --version      "
      "        output version information and exit\n  -p, --prompt=STRING      "
      "  use STRING as an interactive prompt\n  -r, --restricted           run "
      "in restricted mode\n  -s, --quiet, --silent      suppress diagnostics\n "
      " -v, --verbose              be verbose\nStart edit by reading in 'file' "
      "if given.\nIf 'file' begins with a '!', read output of shell command.");
}


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

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

LLVM IR (-O0):
@.str = [488 x i8] c"Ed - The line editor.\0AUsage: ed [options] [file]\0A\0AOptions:\0A -h, --help display this help and exit\0A -V, --version output version information and exit\0A -p, --prompt=STRING use STRING as an interactive prompt\0A -r, --restricted run in restricted mode\0A -s, --quiet, --silent suppress diagnostics\0A -v, --verbose be verbose\0AStart edit by reading in 'file' if given.\0AIf 'file' begins with a '!', read output of shell command.\00"
define void @print_help() {
%1 = call i32 @puts(i8* getelementptr inbounds ([488 x i8], [488 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [488 x i8] c"Ed - The line editor.\0AUsage: ed [options] [file]\0A\0AOptions:\0A -h, --help display this help and exit\0A -V, --version output version information and exit\0A -p, --prompt=STRING use STRING as an interactive prompt\0A -r, --restricted run in restricted mode\0A -s, --quiet, --silent suppress diagnostics\0A -v, --verbose be verbose\0AStart edit by reading in 'file' if given.\0AIf 'file' begins with a '!', read output of shell command.\00"
define void @print_help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([488 x i8], [488 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
char *mstr(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  const char p[] = "minha string aqui!!!", hay[] = "minha";
  printf("output = %s\n", mstr((char *)p, (char *)hay));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xebe(%rip),%eax
mov    %eax,-0x20(%rbp)
mov    0xeb9(%rip),%al
mov    %al,-0x1c(%rbp)
mov    0xeb1(%rip),%eax
mov    %eax,-0x36(%rbp)
mov    0xeab(%rip),%ax
mov    %ax,-0x32(%rbp)
lea    -0x30(%rbp),%rdi
lea    -0x36(%rbp),%rsi
call   1040 <mstr@plt>
mov    %rax,%rsi
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movaps 0xed5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movabs $0x21212169757161,%rax
mov    %rax,0x1d(%rsp)
movw   $0x61,0xc(%rsp)
movl   $0x686e696d,0x8(%rsp)
68
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1040 <mstr@plt>
lea    0xeb7(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.p = [21 x i8] c"minha string aqui!!!\00"
@__const.main.hay = [6 x i8] c"minha\00"
@.str = [13 x i8] c"output = %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [21 x i8]
%7 = alloca [6 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [21 x i8]* %6 to i8*
%9 = bitcast [6 x i8]* %7 to i8*
%10 = getelementptr inbounds [21 x i8], [21 x i8]* %6, i64 0, i64 0
%11 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 0
%12 = call i8* @mstr(i8* %10, i8* %11)
%13 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %12)
ret i32 0
}

LLVM IR (-O2):
@__const.main.p = [21 x i8] c"minha string aqui!!!\00"
@__const.main.hay = [6 x i8] c"minha\00"
@.str = [13 x i8] c"output = %s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [21 x i8]
%4 = alloca [6 x i8]
%5 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 0
%7 = call i8* @mstr(i8* %5, i8* %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %7)
ret i32 0
}
void putch(unsigned char c) {
  while (!(*(volatile unsigned *)(0xBF800000 + (0x6010)) & 0x00000100))
    continue;
again:
  *(volatile unsigned *)(0xBF800000 + (0x6020)) = c;
  while (!(*(volatile unsigned *)(0xBF800000 + (0x6010)) & 0x00000100))
    continue;
  if (c == '\n') {
    c = '\r';
    goto again;
  }
}


x86 assembly (clang, -O0):
<putch>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0xbf806010,%eax
mov    (%rax),%eax
and    $0x100,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    112b <putch+0x2b>
jmp    1130 <putch+0x30>
jmp    110a <putch+0xa>
jmp    1135 <putch+0x35>
movzbl -0x1(%rbp),%ecx
mov    $0xbf806020,%eax
mov    %ecx,(%rax)
mov    $0xbf806010,%eax
mov    (%rax),%eax
and    $0x100,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1161 <putch+0x61>
jmp    1166 <putch+0x66>
jmp    1140 <putch+0x40>
movzbl -0x1(%rbp),%eax
cmp    $0xa,%eax
jne    117c <putch+0x7c>
movb   $0xd,-0x1(%rbp)
jmp    1135 <putch+0x35>
pop    %rbp
ret

x86 assembly (clang, -O2):
<putch>:
mov    $0xbf806010,%eax
cs nopw 0x0(%rax,%rax,1)
nop
testl  $0x100,(%rax)
je     1110 <putch+0x10>
nopl   0x0(%rax,%rax,1)
movzbl %dil,%ecx
mov    %ecx,0x10(%rax)
nopw   0x0(%rax,%rax,1)
testl  $0x100,(%rax)
je     1130 <putch+0x30>
cmp    $0xa,%dil
mov    $0xd,%dil
je     1120 <putch+0x20>
ret

LLVM IR (-O0):
define void @putch(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
br label %3
3: ; preds = %8, %1
%4 = load volatile i32, i32* inttoptr (i64 3212861456 to i32*)
%5 = and i32 %4, 256
%6 = icmp ne i32 %5, 0
%7 = xor i1 %6, true
br i1 %7, label %8, label %9
8: ; preds = %3
br label %3
9: ; preds = %3
br label %10
10: ; preds = %23, %9
%11 = load i8, i8* %2
%12 = zext i8 %11 to i32
store volatile i32 %12, i32* inttoptr (i64 3212861472 to i32*)
br label %13
13: ; preds = %18, %10
%14 = load volatile i32, i32* inttoptr (i64 3212861456 to i32*)
%15 = and i32 %14, 256
%16 = icmp ne i32 %15, 0
%17 = xor i1 %16, true
br i1 %17, label %18, label %19
18: ; preds = %13
br label %13
19: ; preds = %13
%20 = load i8, i8* %2
%21 = zext i8 %20 to i32
%22 = icmp eq i32 %21, 10
br i1 %22, label %23, label %24
23: ; preds = %19
store i8 13, i8* %2
br label %10
24: ; preds = %19
ret void
}

LLVM IR (-O2):
define void @putch(i8 zeroext %0) {
br label %2
2: ; preds = %2, %1
%3 = load volatile i32, i32* inttoptr (i64 3212861456 to i32*)
%4 = and i32 %3, 256
%5 = icmp eq i32 %4, 0
br i1 %5, label %2, label %6
6: ; preds = %2, %13
%7 = phi i8 [ 13, %13 ], [ %0, %2 ]
%8 = zext i8 %7 to i32
store volatile i32 %8, i32* inttoptr (i64 3212861472 to i32*)
br label %9
9: ; preds = %9, %6
%10 = load volatile i32, i32* inttoptr (i64 3212861456 to i32*)
%11 = and i32 %10, 256
%12 = icmp eq i32 %11, 0
br i1 %12, label %9, label %13
13: ; preds = %9
%14 = icmp eq i8 %7, 10
br i1 %14, label %6, label %15
15: ; preds = %13
ret void
}
/* Variables and functions */
int syscall(int, char const *, int);
int umount2(const char *special, int flags) {
  return syscall(52, special, flags);
}


x86 assembly (clang, -O0):
<umount2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    $0x34,%edi
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<umount2>:
mov    %esi,%edx
mov    %rdi,%rsi
mov    $0x34,%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
define i32 @umount2(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i32 @syscall(i32 52, i8* %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @umount2(i8* %0, i32 %1) {
%3 = tail call i32 @syscall(i32 52, i8* %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ dmmdda_(int *, int *, double *, double *, int *, double *,
                           double *, int *);
void wcc_dmmdda_(int *M, int *N, char *ALPHA, char *A, int *LDA, char *BETA,
                 char *B, int *LDB) {
  dmmdda_(M, N, (double *)ALPHA, (double *)A, LDA, (double *)BETA, (double *)B,
          LDB);
}


x86 assembly (clang, -O0):
<wcc_dmmdda_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1030 <dmmdda_@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcc_dmmdda_>:
jmp    1030 <dmmdda_@plt>

LLVM IR (-O0):
define void @wcc_dmmdda_(i32* %0, i32* %1, i8* %2, i8* %3, i32* %4, i8* %5, i8* %6, i32* %7) {
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i32*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i32*
store i32* %0, i32** %9
store i32* %1, i32** %10
store i8* %2, i8** %11
store i8* %3, i8** %12
store i32* %4, i32** %13
store i8* %5, i8** %14
store i8* %6, i8** %15
store i32* %7, i32** %16
%17 = load i32*, i32** %9
%18 = load i32*, i32** %10
%19 = load i8*, i8** %11
%20 = bitcast i8* %19 to double*
%21 = load i8*, i8** %12
%22 = bitcast i8* %21 to double*
%23 = load i32*, i32** %13
%24 = load i8*, i8** %14
%25 = bitcast i8* %24 to double*
%26 = load i8*, i8** %15
%27 = bitcast i8* %26 to double*
%28 = load i32*, i32** %16
%29 = call i32 @dmmdda_(i32* %17, i32* %18, double* %20, double* %22, i32* %23, double* %25, double* %27, i32* %28)
ret void
}

LLVM IR (-O2):
define void @wcc_dmmdda_(i32* %0, i32* %1, i8* %2, i8* %3, i32* %4, i8* %5, i8* %6, i32* %7) {
%9 = bitcast i8* %2 to double*
%10 = bitcast i8* %3 to double*
%11 = bitcast i8* %5 to double*
%12 = bitcast i8* %6 to double*
%13 = tail call i32 @dmmdda_(i32* %0, i32* %1, double* %9, double* %10, i32* %4, double* %11, double* %12, i32* %7)
ret void
}
/* Variables and functions */
size_t strcspn(char const *, char const *);
int sr_skip_char_cspan(const char **input, const char *reject) {
  size_t count = strcspn(*input, reject);
  if (0 == count)
    return count;
  *input += count;
  return count;
}


x86 assembly (clang, -O0):
<sr_skip_char_cspan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcspn@plt>
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
cmp    -0x20(%rbp),%rax
jne    114c <sr_skip_char_cspan+0x3c>
mov    -0x20(%rbp),%rax
mov    %eax,-0x4(%rbp)
jmp    1161 <sr_skip_char_cspan+0x51>
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rax
add    (%rax),%rcx
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sr_skip_char_cspan>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%rbx
mov    %rbx,%rdi
call   1030 <strcspn@plt>
test   %rax,%rax
je     112f <sr_skip_char_cspan+0x1f>
add    %rax,%rbx
mov    %rbx,(%r14)
jmp    1131 <sr_skip_char_cspan+0x21>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @sr_skip_char_cspan(i8** nocapture %0, i8* nocapture %1) {
%3 = load i8*, i8** %0
%4 = tail call i64 @strcspn(i8* %3, i8* %1)
%5 = icmp eq i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %3, i64 %4
store i8* %7, i8** %0
%8 = trunc i64 %4 to i32
br label %9
9: ; preds = %2, %6
%10 = phi i32 [ %8, %6 ], [ 0, %2 ]
ret i32 %10
}
/* Variables and functions */
bool nrf51_errata_30(void) { return false; }


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

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

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

LLVM IR (-O2):
define i32 @nrf51_errata_30() {
ret i32 0
}
int logxor(int log1, int log2) {
  return (((log1) || (log2)) && (!(log1) || !(log2)));
}


x86 assembly (clang, -O0):
<logxor>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1123 <logxor+0x23>
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     1144 <logxor+0x44>
mov    $0x1,%al
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0xa(%rbp)
je     113e <logxor+0x3e>
cmpl   $0x0,-0x8(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<logxor>:
mov    %esi,%eax
or     %edi,%eax
setne  %al
test   %esi,%esi
sete   %cl
test   %edi,%edi
sete   %dl
or     %cl,%dl
and    %al,%dl
movzbl %dl,%eax
ret

LLVM IR (-O0):
define i32 @logxor(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 = icmp ne i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %19
10: ; preds = %7, %2
%11 = load i32, i32* %3
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 0
%16 = xor i1 %15, true
br label %17
17: ; preds = %13, %10
%18 = phi i1 [ true, %10 ], [ %16, %13 ]
br label %19
19: ; preds = %17, %7
%20 = phi i1 [ false, %7 ], [ %18, %17 ]
%21 = zext i1 %20 to i32
ret i32 %21
}

LLVM IR (-O2):
define i32 @logxor(i32 %0, i32 %1) {
%3 = or i32 %1, %0
%4 = icmp ne i32 %3, 0
%5 = icmp eq i32 %1, 0
%6 = icmp eq i32 %0, 0
%7 = or i1 %6, %5
%8 = and i1 %4, %7
%9 = zext i1 %8 to i32
ret i32 %9
}